change behavior of python Exception to send emails
I want to change the behavior of Exceptions (all of them) in python to send emails without changing code very much or using special error handlers everywhere.

My hope is to subclass Exception and then redefine it at the beginning of a given module.

So the subclassing is here:

    class ExceptionMailer(Exception):
        def __init__(self, m):
            self.message = m
            send_email(email_address,self.message)

Then at the at the begining of a module I can do this:

    Exception = ExceptionMailer

Then when an Exception is raised an email with it's message is sent. I have gotten this to work strictly for `Exception`  but not for say `ValueError`. My hope was that redefining `Exception` would redefine all the error types but I was clearly wrong. Is what I am trying to do possible?
change behavior of python Exception to send emails
===

I want to change the behavior of Exceptions (all of them) in python to send emails without changing code very much or using special error handlers everywhere.

My hope is to subclass Exception and then redefine it at the beginning of a given module.

So the subclassing is here:

    class ExceptionMailer(Exception):
        def __init__(self, m):
            self.message = m
            send_email(email_address,self.message)

Then at the at the begining of a module I can do this:

    Exception = ExceptionMailer

Then when an Exception is raised an email with it's message is sent. I have gotten this to work strictly for `Exception`  but not for say `ValueError`. My hope was that redefining `Exception` would redefine all the error types but I was clearly wrong. Is what I am trying to do possible?