Custom Renderers & Exception Handling #8336
Unanswered
swt2c
asked this question in
Ideas & Suggestions
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
I have some custom renderers that render data in CSV format. These renderer classes are used on views that require authentication. I recently noticed that if an unauthenticated request comes in for one of these views, DRF will still pass the "permission denied" exception to the custom renderer for rendering. In my case, this was resulting in a failure because my CSV renderer was being passed data it wasn't expecting. I could probably change the renderers to check whether they are being passed an exception and render JSON instead, but perhaps it might make sense for renderers to be able to mark themselves as exception-handling or not?
Beta Was this translation helpful? Give feedback.
All reactions