Could you correct me if I'm wrong in interpreting your remarks:
I could create a new view , and then just forget about the NewResponse
subscriber ?
The way the 'uncaught' exception bubbles up is a little weird -- it
doesn't seem to exist anywhere within the event. It just gets marked
as "None" ( vs the request not having an attribute ). it would be
really useful if it was logged.
-----
from sqlalchemy.exc import OperationalError as
SqlAlchemyOperationalError
@view_config(context=SqlAlchemyOperationalError)
def failed_sqlalchemy(exception , request):
"""do whatever here"
pass
On Mar 21, 1:32 pm, Michael Merickel <[email protected]> wrote:
> Exception handling in pyramid is pretty straightforward.
>
> If an exception occurs for the first time, and isn't caught by your code,
> then pyramid will perform view lookup using that exception as the context.
> Those views can have their own renderers, permissions and predicates. If
> another unhandled exception occurs or no matching exception view is found,
> it leaves pyramid and bubbles up the wsgi stack where the server usually
> turns it into a 500.
>
> While the exception view is being handled, request.exception and
> request.exc_info should be populated (at least on 1.3+), so you could deal
> with that in a NewResponse subscriber if necessary.
>
> On Wed, Mar 21, 2012 at 12:10 PM, Jonathan Vanasco
> <[email protected]>wrote:
>
>
>
>
>
>
>
> > I'm using pyramid and SqlAlchemy, but not pyramid_tm.
>
> > If the server is down, the following exception is raised:
> > sqlalchemy.exc.OperationalError
>
> > I'm wondering how i can best catch this , so i can handle internal
> > alerts and possibly change the response.
>
> > the only thing available in a NewResponse subscriber is :
> > event.request.exception = None
>
> > examining all of the objects in event, the actual error isn't logged
> > anywhere ( as its not an Exception View ). does anyone have a clue on
> > another approach i can take ?
>
> > --
> > You received this message because you are subscribed to the Google Groups
> > "pylons-discuss" 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/pylons-discuss?hl=en.
--
You received this message because you are subscribed to the Google Groups
"pylons-discuss" 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/pylons-discuss?hl=en.