On Wed, May 16, 2012 at 12:32 PM, Rory Campbell-Lange <r...@campbell-lange.net> wrote: > I'm obviously whistling in the breeze here, but I'd be very grateful for > some help. I've provided some more info below. > > I have a view raising a specific exception I would like to catch and > provide an HttpResponse based on this exception.
If it is one view raising one specific exception, why aren't you catching it in that view? Exception middleware is used to provide a more generic error page, or for advanced error handling, or to handle errors from a number of views. If it is just for one view, one exception, it is more coherent to handle the error in the view. > > I cannot trigger the exception middleware either as standard middleware > or using decorator_from_middleware. > > My middleware is as follows -- its simply a sketch at present: > > class ExceptCatcher(object): > def process_exception(self, request, exception): > HttpResponse("Error encountered") Is this code verbatim? If so, you aren't returning the newly generated HttpResponse, just creating it. These sorts of questions should be on django-users really. Cheers Tom -- 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.