webmcp

view framework/env/request/add_error_handler.lua @ 566:3b71fdb3a00d

Updated year + version in documentation
author jbe
date Wed Apr 28 12:54:38 2021 +0200 (2021-04-28)
parents d89813dd4d92
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