mirror of
https://github.com/hkalexling/Mango.git
synced 2025-08-03 11:25:29 -04:00
Handle HTTP 404 and 500 errors
This commit is contained in:
parent
30af64e9ca
commit
306edc3c77
@ -10,7 +10,16 @@ class Server
|
|||||||
def initialize(@context : Context)
|
def initialize(@context : Context)
|
||||||
|
|
||||||
error 403 do |env|
|
error 403 do |env|
|
||||||
message = "You are not authorized to visit #{env.request.path}"
|
message = "HTTP 403: You are not authorized to visit " \
|
||||||
|
"#{env.request.path}"
|
||||||
|
layout "message"
|
||||||
|
end
|
||||||
|
error 404 do |env|
|
||||||
|
message = "HTTP 404: Mango cannot find the page #{env.request.path}"
|
||||||
|
layout "message"
|
||||||
|
end
|
||||||
|
error 500 do |env|
|
||||||
|
message = "HTTP 500: Internal server error. Please try again later."
|
||||||
layout "message"
|
layout "message"
|
||||||
end
|
end
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user