On further investigation it appears that the process_exception
middleware isn't being called in my case. In other words, 

 /usr/lib/python2.7/dist-packages/django/utils/decorators.py:
 92                 except Exception, e:
 93                     import ipdb; ipdb.set_trace()
 94                     if hasattr(middleware, 'process_exception'):
 95                         result = middleware.process_exception(request, e)
 96                         if result is not None:
 97                             return result

I'm not familiar enough with Django to work out the relationship between
base.py and decorators.py. However the middleware class above does not have the
class I have loaded in base.py's self._exception_middleware. Should it have?

Rory

On 14/05/12, Rory Campbell-Lange (r...@campbell-lange.net) wrote:
> I have a custom database interface with (amongst other things) a lazy
> rowgetter. Our database provides custom exception messages when, for instance,
> a rate limit is exceeded.
> 
> Because of the "laziness" of the rowgetter, the except clause in my view
> (shown below) is not triggered, and control falls to
> core/handlers/base.py : handle_uncaught_exception.
> 
>     try:
>         rota = self.model.xmlapi_get_location (**kwargs)
>     except DBException, e:
>         code, message = [epart.strip() for epart in e.msg.split(':')]
>         return HttpResponse(message, status=code,
>                             content_type="text/plain")
> 
> I've tried the following:
> 
> * The use of middleware using "process_exception" : DBException not raised
> * handler500 in urls : DBException not available
> 
> Consequently I believe I need to either make my lazy rowgetter less lazy so
> that it errors earlier, or subclass handle_uncaught_exception. If the latter 
> is
> feasible I'd be grateful for some advice on how to do so within my app.
> 
> Rory
> 
> p.s.
> An earlier version of this question was asked on Stack Overflow at
> http://stackoverflow.com/questions/10574581/reroute-djangos-handle-uncaught-exception

-- 
Rory Campbell-Lange
r...@campbell-lange.net

-- 
You received this message because you are subscribed to the Google Groups 
"Django developers" group.
To post to this group, send email to django-developers@googlegroups.com.
To unsubscribe from this group, send email to 
django-developers+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-developers?hl=en.

Reply via email to