Django + Raygun and catching HTTP error codes

tebel

Posted on
Jun 10 2015

Greetings, Raygun.

I have the initial configuration working using the python docs. I used the Django middleware option in setting up. I receive the test error when running "raygun4py test your_apikey". However, I am not seeing any HTTP error codes being sent over. i.e. 500, 401, 403, etc... Did I miss this in the docs somewhere ? OR do I need to manually add exception handlers for each case ? I was presuming that the middleware library did this for me automagically.

Thanks in advance!

Tyler.


Callum

Posted on
Jun 10 2015

The Django middleware is a recent addition to raygun4py so there may be features missing that could be added to it. However from our reading of the process_exception documentation during the development of it, middleware are designed to be chained and they may return either None or an HttpResponse.

As the raygun4py middleware has the single responsibility of sending the current exception, it returns None and allows other middleware to run, which would take care of setting the HttpResponse and status code at that time, then rendering the appropriate error view. The status code thus wouldn't be set at the time of sending the error to Raygun, so we can't send it currently.

If you have a suggestion about how we could provide this data we're more than happy to look at this - note that we also accept pull requests at https://github.com/MindscapeHQ/raygun4py.


Reply