Comparison

plugins/mod_http_errors.lua @ 10574:f70c874b7936

mod_http_errors: Use text from util.errror object if included This makes util.error objects useful for more than just an error code container.
author Kim Alvefur <zash@zash.se>
date Sun, 29 Dec 2019 22:20:51 +0100
parent 10430:46dd9df2db0c
child 11153:e4075ca84a1a
comparison
equal deleted inserted replaced
10573:3b8431eed785 10574:f70c874b7936
71 71
72 module:hook_object_event(server, "http-error", function (event) 72 module:hook_object_event(server, "http-error", function (event)
73 if event.response then 73 if event.response then
74 event.response.headers.content_type = "text/html; charset=utf-8"; 74 event.response.headers.content_type = "text/html; charset=utf-8";
75 end 75 end
76 return get_page(event.code, (show_private and event.private_message) or event.message); 76 return get_page(event.code, (show_private and event.private_message) or event.message or (event.error and event.error.text));
77 end); 77 end);
78 78
79 module:hook_object_event(server, "http-error", function (event) 79 module:hook_object_event(server, "http-error", function (event)
80 local request, response = event.request, event.response; 80 local request, response = event.request, event.response;
81 if request and response and request.path == "/" and response.status_code == 404 then 81 if request and response and request.path == "/" and response.status_code == 404 then