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

Campbell-Lange Workshop
www.campbell-lange.net
0207 6311 555
3 Tottenham Street London W1T 2AF
Registered in England No. 04551928

-- 
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