title: Python -- Send Email When Exception Is Raised?
body: <p>I have a <code>python</code> class with many methods():</p>
  
  <p><code>Method1()</code></p>
  
  <p><code>Method2()</code></p>
  
  <p>...........</p>
  
  <p>...........</p>
  
  <p><code>MethodN()</code></p>
  
  <p>All methods -- while performing different tasks -- have the same scheme:</p>
  
  <pre><code>do something
  do something else
  has anything gone wrong?
      raise an exception
  </code></pre>
  
  <hr>
  
  <p>I want to be able to get an email whenever an exception is raised anywhere in the class.</p>
  
  <p>Is there some easy way to combine this logic into the class, rather than calling <code>SendEmail()</code> before every <code>raise Exception</code> statement? what is the right, pythonic way to deal with such a case? canh a 'generalized' Exception handler be the solution? I'd be glad for any ideas you may have.</p>