1 # This file is part of NIT ( http://www.nitlanguage.org ).
3 # Copyright 2014 Alexis Laferrière <alexis.laf@xymus.net>
5 # Licensed under the Apache License, Version 2.0 (the "License");
6 # you may not use this file except in compliance with the License.
7 # You may obtain a copy of the License at
9 # http://www.apache.org/licenses/LICENSE-2.0
11 # Unless required by applicable law or agreed to in writing, software
12 # distributed under the License is distributed on an "AS IS" BASIS,
13 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 # See the License for the specific language governing permissions and
15 # limitations under the License.
17 # Offers `ErrorTemplate` to display error pages
24 # A basic error page for the HTTP error `code`
29 var code
: Int is writable
32 var header
: nullable Writable = null is writable
34 # Body to show with this page
35 var body
: nullable Writable = null is writable
39 var code_message
= http_status_codes
[code
]
41 if code_message
!= null then
42 message
= "Error {code}: {code_message}"
43 else message
= "Error {code}"
48 <meta charset="utf-8">
49 <meta http-equiv="X-UA-Compatible" content="IE=edge">
50 <link rel="stylesheet" href="//maxcdn.bootstrapcdn.com/bootstrap/3.2.0/css/bootstrap.min.css">
59 if header
!= null then add header
62 <div class="container">
68 if body
!= null then add body
76 redef fun to_s
do return write_to_string