If an exception (other than HTTP) is raised, web2py does the following:
"""
Could be a little complicated. The relevant code is in gluon.restricted -- see https://github.com/web2py/web2py/blob/4f51647b2f5bd68887ddd9fe139c6bbc0fa885d4/gluon/restricted.py#L115.
You could create a RestrictedError (don't raise it, though, as that will trigger web2py's error processing). Calling the .log() method on that error object should then generate the ticket. Note, you'll be responsible for specifying the proper values for the "layer", "code", and "environment" arguments to RestrictedError() (for "environment", current.globalenv should be the proper value).
On Thursday, December 14, 2017 at 4:10:40 AM UTC-8, Anthony wrote:Could be a little complicated. The relevant code is in gluon.restricted -- see https://github.com/web2py/web2py/blob/4f51647b2f5bd68887ddd9fe139c6bbc0fa885d4/gluon/restricted.py#L115.
That is unfortunate. Would be nice to have this in a more modularized fashion, but I'll see if I can make it work.
try:
[some code]
except:
db.error.insert(exception=traceback.format_exc())
You could create a RestrictedError (don't raise it, though, as that will trigger web2py's error processing). Calling the .log() method on that error object should then generate the ticket. Note, you'll be responsible for specifying the proper values for the "layer", "code", and "environment" arguments to RestrictedError() (for "environment", current.globalenv should be the proper value).
Cool, thanks. But what about "code"? It looks like RestrictedError is mainly called from the restricted() function, and everywhere I can see that calls restricted() has a bunch of complicated logic in the same function to determine what to pass for its "ccode" argument. Is there a way to access this information from within controller code?