Somewhere in my views, I throw an error, particularly this one:
views.py
from xmlrpclib import Fault
def some_function(request):
if ....:
return Fault(-1, 'foo')
Then, also in views.py, I have my custom 500 handler to catch server errors:
def my_custom_500(request):
context = {...}
### Here is where I need to catch `'foo'`
### in order to put it in the context and pass it to the template
render(request, '500.html', context)
Is there anyway in which I can access the error message?
Thanks
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…