-
-
Notifications
You must be signed in to change notification settings - Fork 7k
I found a problem in the rest_framework/views.py file #6404
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
Comments
raise on its own will reraise the latest exception |
A few thoughts:
|
Good question, actually! |
非常感谢“encode”成员再次关注这个问题。 try:
drf code...
except Exception:
write error log... 2.使用"raise exc": try:
drf code...
except (OSError, IOError):
write panic log...
except CustomError:
write log... 我认为第二种方式更加优雅和清晰。 |
@tomchristie, had a bit of a think and As an unlikely example, a user might override >>> def handle(exc):
... raise
...
>>> try:
... raise Exception('!!!')
... except Exception as exc:
... handle(TypeError('???'))
...
Traceback (most recent call last):
File "<stdin>", line 4, in <module>
File "<stdin>", line 2, in <module>
Exception: !!! >>> def handle(exc):
... raise exc
...
>>> try:
... raise Exception('!!!')
... except Exception as exc:
... raise TypeError('???')
...
Traceback (most recent call last):
File "<stdin>", line 2, in <module>
Exception: !!!
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "<stdin>", line 4, in <module>
TypeError: ??? Either way, I can't think of a reason to keep a bare |
Uh oh!
There was an error while loading. Please reload this page.
Hello, good evening. I found a problem in the
rest_framework/views.py
file. See the source code snippet below:What program exception do you want to throw? I guess uncaught exception.
I uninstall it and reinstall it like this. My installation process is as follows:
The text was updated successfully, but these errors were encountered: