Looking at this code:
try:
... # do something
except:
raise Exception('XYZ has gone wrong...')
Even with DEBUG=True
, I don't want this raise Exception
to give that yellow page, but it does.
I want to handle the exception by redirecting users to an error page or shows the error (give a CSS error message on the top of the page...)
How do I handle that? If I simply raise it, I will get yellow debug page (again, I don't want certain exceptions to stop the site from functioning by showing the debug page when DEBUG=True).
How do I handle these exceptions in views.py?
raise
and follow the Django's style? Is there a slight modification to achieve that? – Immunochemistry