webmcp

view framework/env/request/add_error_handler.lua @ 497:d89813dd4d92

New function request.add_error_handler(...); Allow layout_ident to be passed directly to slot.render_layout(...)
author jbe
date Sun Jul 23 02:51:13 2017 +0200 (2017-07-23)
parents
children
line source
1 --[[--
2 request.add_error_handler(
3 function(errobj, stacktrace)
4 ...
5 end
6 )
8 Registers a function to be called after an error occurred during request handling and the error response has been prepared by filling the "trace" and "system_error" slots in request.handler(...). The registered handler may, for example, send an error report to an administrator (utilizing slot.render_layout(...)). The passed handler function gets the error message (or error object) passed as first argument and the stacktrace as second argument.
10 --]]--
12 function request.add_error_handler(func)
13 request.configure(function()
14 local handlers = request._error_handlers
15 handlers[#handlers+1] = func
16 end)
17 end

Impressum / About Us