catching sqlalchemy exceptions

2012-03-21 Thread Jonathan Vanasco
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 NewRespon

Re: catching sqlalchemy exceptions

2012-03-21 Thread Michael Merickel
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 e

Re: catching sqlalchemy exceptions

2012-03-21 Thread Jonathan Vanasco
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" (

Re: catching sqlalchemy exceptions

2012-03-21 Thread Michael Merickel
On Wed, Mar 21, 2012 at 1:06 PM, Jonathan Vanasco wrote: > > 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 logg

Re: catching sqlalchemy exceptions

2012-03-21 Thread Jonathan Vanasco
On Mar 21, 2:11 pm, Michael Merickel wrote: > The only way a NewResponse subscriber would be invoked *after* an exception > occured is if you are handling the exception in an exception view. If > that's the case, then you are rendering a new view and as part of the > rendering, NewResponse will

Re: catching sqlalchemy exceptions

2012-03-21 Thread Michael Merickel
The NewResponse subscriber will not be executed if you don't have an exception view unless it executes before the exception occurs. Maybe you need to post an example application with the behavior you're seeing. There's 2 code paths... 1) serving a request in normal operation, and 2) for handling an

Re: catching sqlalchemy exceptions

2012-03-21 Thread Jonathan Vanasco
https://github.com/jvanasco/pyramid_exceptionstest If you hit /hello_world it raises a ValueError. There is no Exception View configured for ValueError. The NewResponse subscriber catches it. -- You received this message because you are subscribed to the Google Groups "pylons-discuss" group. T

Re: catching sqlalchemy exceptions

2012-05-15 Thread Jonathan Vanasco
nearly 2 months later, i figured this out. my errors were due to the debug system being enabled in development.ini the NewResponse subscriber is not caught in production.ini i'll flag this on the devel mailing list, as the docs for NewSubscriber or the Debug should reflect this. -- You receive