Accessing the 404 error message in a custom page

31 views
Skip to first unread message

Yan Wong

unread,
Apr 19, 2020, 5:28:12 PM4/19/20
to web2py-users
I want to have a custom styled page for my 404 errors, so that when I do raise(404, 'bad values') it returns a nicely styled page. I have placed the following line in my routes.py

routes_onerror = [('myapp/404', '/myapp/default/custom_404.html')]

but I don't know how to access the error message itself ('bad values' in this case) within the custom page. It doesn't seem to exist in the request object?

Yan Wong

unread,
Apr 19, 2020, 5:31:03 PM4/19/20
to web2py-users
Sorry, I meant a page for HTTP 400 errors, not 404 errors, e.g. when I call raise HTTP(404, 'bad values'), but the principle is the same.
Reply all
Reply to author
Forward
0 new messages