Actually if you know you are on GAE and you have db=GQLDB()
def mycacher(f):
import gluon.restricted, traceback
import google.appengine.api
try:
d=f()
if isinstance(d,dict): return response.sender(d)
return d
except Exception, e:
t=traceback.format_exc()
#code that writes stacktrace to a log or database>
id=db.define_table('web2py_errors',db.Field
('stacktrace')).insert(stacktrace=t)
#code that sends and error email
google.appengine.api.mail.send_mail(sender=sender,
to=to,subject=subject,body=t)
#code that redirects to a friendly action and passes the
ticket id
redirect(URL(r=request,f='friendly_action_page',args=id)
response._caller=myctcher
this catches errors in actions and views, not in models.
On Jan 8, 3:38 pm, Timothy Farrell <[email protected]> wrote:
> More like:
>
> def mycacher(f):
> import gluon.restricted
> try: f()
> except restricted.RestrictedError, e:
> <code that writes stacktrace to a log or database>
> <code that sends and error email>
> <code that displays a friendly page>
>
> response._caller=myctcher
>
> You can't raise a magic Exception and expect it to get past the ticket
> system. There is no exception that will get past the "except:" on
> main.py line 259.
>
> Sorry.
>
>
>
> mdipierro wrote:
> > I am not sure. You will need to fill the blanks...
>
> > def mycacher(f):
> > import gluon.restricted
> > try: f()
> > except restricted.RestrictedError, e:
> > raise ....fill here....
> > response._caller=myctcher
>
> > What exception should I raise to get the stacktrace stored in
> > e.stacktrace?
>
> > Massimo
>
> > On Jan 8, 3:17 pm, Robin B <[email protected]> wrote:
>
> >> Web2py tries to write exceptions to tickets even on GAE dev_appserver
> >> where it cannot write tickets, so the result is no debugging
> >> information.
>
> >> What is the best way to simply disable web2py's ticket system and let
> >> the exception raise to the outer WSGI handler that prints a detailed
> >> stack trace?
>
> >> Thanks,
>
> >> Robin
>
> --
> Timothy Farrell <[email protected]>
> Computer Guy
> Statewide General Insurance Agency (www.swgen.com)
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"web2py Web Framework" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/web2py?hl=en
-~----------~----~----~----~------~----~------~--~---