Closed rjpcomputing closed 9 years ago
Hello.
The only way to do this at the moment is to reimplement the ErrorHandler.
turbo.web.ErrorHandler = class("ErrorHandler", web.RequestHandler)
function turbo.web.ErrorHandler:initialize(app, request, code, message)
turbo.web.RequestHandler.initialize(self, app, request)
if (message) then
self:write(message)
end
self:set_status(code)
self:finish()
end
Change this to whatever you want. This will be global towards all of your Applications and RequestHandlers though, so you have to run in separate processes if you want different behaviours.
Hi,
I could not find a way to override the default behavior of the error 404, 400, 500 errors. I would like to automatically send a JSON "error" structure that has been defined in other apps I have written. Can these default errors be overwritten?
Thanks.