0

Is there any way to "tell" Django when to send emails to admins and when not? For instance, I'd like to not send an email when a DatabaseError exception is thrown.

I thought of creating a middleware and return None if exception was of type DatabaseError, but I believe that'd just cause to call the default handler.

Any insight or suggestion to achieve this and avoid cluttering admins' inboxes :) ?

carl-lopez
  • 584
  • 5
  • 12
  • you can use `try` and `except` to catch that error – catherine Apr 04 '13 at 01:56
  • That'd still send the error report to emails in admins list – carl-lopez Apr 04 '13 at 03:29
  • No, if you catch the error where it occurs in your application, it will not be emailed to the admins. An (uncatched) error, after all, is still an error, and should not pass silently (according to the Zen). Your users will likely see it as a server error, too. If errors are cluttering your inbox, fix the app instead. Treat exceptions that should not be considered errors in a special way, by wrapping them in an appropriate except clause. – bhell Apr 04 '13 at 04:31
  • Right, but the issue is that some searches in the admin are causing that exception and I'd prefer not to alter that code – carl-lopez Apr 07 '13 at 05:48

0 Answers0