I want to be able to use the abort function from pylons.controllers.util to display 404, 500 error pages with info on what went wrong, but at the same time make the abort function send me exception emails from the errormiddleware.
Right now, I've got this:
try:
do(this)
except:
abort(500, 'Something went wrong!')
This displays a page with the 500 header and my message, which is nice. But what I want, is to get the standard exception e-mails sent to me, even though I've returned the 500 error myself.
Is there a way to do this? Can I somehow run the errormiddleware function from there? Any ideas appreciated.
Pylons already has very good error reporting to an email via error_email_from and email_to params in the config .ini file.
For example:
[DEFAULT]
email_to = [email protected]
error_email_from = [email protected]
Update: There are 2 ways of doing what you want to achieve:
error.py
controller's 'document
' method (fast but hacky way).