In some situations, when my web2py code raises an exception, what I want to
do is log information about what happened, but then handle it in some way
that doesn't involve the default error handling. The advantage of the
default error handling, though, is that it generates an error ticket. Is
there a way to "manually" generate a ticket, so that I could log the ticket
ID for later inspection, while still attempting to recover from the error?
I'd like to be able to do something like this (inside a function in a
controller or module):
try:
do_something()
except ValueError as e:
ticket = create_ticket_from_exception_somehow(e)
my_logger.log(ticket.id_number)
# code here to recover from error
Is there a function like create_ticket_from_exception_somehow? All I can
find in the docs is this:
"""
If an exception (other than HTTP) is raised, web2py does the following:
- Stores the traceback in an error file and assigns a ticket number to
it.
- Rolls back all open database transactions.
- Returns an error page reporting the ticket number.
"""
I want to do just the first part of that: store the traceback with the
ticket number, so I can later view the ticket from the admin interface, but
NOT do anything else --- just give me the ticket number and let me log it
myself.
--
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
---
You received this message because you are subscribed to the Google Groups
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/d/optout.