New issue
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
Create should give much more useful exceptions when TypeError occurs #3503
Comments
I'd be happy to consider pull requests, but otherwise not obv what we should do differently here. We include the original exception text, but add a bit of extra context to explain why its being raised. No idea if we can (or would want to) preserve the original traceback. |
I've made a PR, I think you should display the original traceback in the message. To be honest I think you should not catch the exception at all, but I guess the modified message might be helpful to new users. However it is swallowing important error information for no real reason, which should be changed. |
Hi there,
I get you're trying to be helpful by displaying that text, but really you are swallowing the entire exception which makes it a lot harder to debug and throwing away most of the actually useful information. Please please consider my MR. |
This is the bane of my life. Line 845 in serializers.py needs to be changed to be a lot more helpful when a TypeError does occur.
If you have custom .save() methods and something goes wrong then DRF only gives you the exception message, which might be as useful as "X is not iterable". Can DRF perhaps include the traceback of the original TypeError or do anything a bit more useful than spit out a default message and swallow the original exception?
The text was updated successfully, but these errors were encountered: