We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Hello,
we are happy users of rollbar but recently we came across the following problem: When we use the following settings:
REST_FRAMEWORK = { 'EXCEPTION_HANDLER': 'rollbar.contrib.django_rest_framework.post_exception_handler' }
and UnsupportedMediaType error is raised, the request fails with 500 status instead of 415.
UnsupportedMediaType
The problem is in the line 21
context['request']._request.POST = context['request'].data
where the data attribute tries to read the data but these cannot be parsed as the media type is not supported.
data
For now, we created the following workaround:
from rest_framework.exceptions import APIException, UnsupportedMediaType, ParseError from rollbar.contrib.django_rest_framework import post_exception_handler, RestFrameworkExceptionHandler def custom_exception_handler(exc: Union[Exception, APIException], context: dict) -> Response: # Call Rollbar's post exception handler first, to get the standard error response. try: return post_exception_handler(exc, context) except (UnsupportedMediaType, ParseError): return RestFrameworkExceptionHandler(exc, context)
But is there a proper way how to handle this? With regards Krystof
The text was updated successfully, but these errors were encountered:
This will need to be addressed in the upcoming release. Thanks for sharing your temporary solution for now :)
Sorry, something went wrong.
My pleasure :)
It looks like this was never fixed as promised, but I fixed it with PR #335
ArturMoczulski
Successfully merging a pull request may close this issue.
Hello,
we are happy users of rollbar but recently we came across the following problem:
When we use the following settings:
and
UnsupportedMediaType
error is raised, the request fails with 500 status instead of 415.The problem is in the line 21
where the
data
attribute tries to read the data but these cannot be parsed as the media type is not supported.For now, we created the following workaround:
But is there a proper way how to handle this?
With regards
Krystof
The text was updated successfully, but these errors were encountered: