-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy patherror_page.lua
45 lines (39 loc) · 1.22 KB
/
error_page.lua
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
local _M = {}
local errors_map = {
["default"] = {
title = "Something went wrong",
message = "We're very sorry for any inconvenience, our service team has been notified."
},
--[502] = {
-- title = "Something went wrong",
-- message = "We're very sorry for any inconvenience, our service team has been notified."
--},
--[503] = {
-- title = "Something went wrong",
-- message = "We're very sorry for any inconvenience, our service team has been notified."
--},
--[504] = {
-- title = "Something went wrong",
-- message = "We're very sorry for any inconvenience, our service team has been notified."
--},
[404] = {
title = "That site doesn't seem to exist",
message = "Sorry, but there's nothing to see."
}
}
local function getVars(code)
if errors_map[code] then
return errors_map[code]
else
return errors_map["default"]
end
end
local template = require "resty.template".new({
root = "/etc/lurch",
location = "/etc/lurch"
})
function _M.go(err_code)
local vars = getVars(err_code)
template.render("error.html", { title = vars["title"], message = vars["message"] })
end
return _M