title: Store an object created by the exception when it is raised, Python
body: <p>Here is my exception class,</p>
  
  <pre><code>class SampleError(Exception):
      def __init__(self):
          self.history = Stack()
  </code></pre>
  
  <p>Here is the function,</p>
  
  <pre><code>def f(x):
      raise SampleError
  </code></pre>
  
  <p>When f(x) is run, how to I store the stack that is created while SampleError is raised.</p>
  
  <p>Thanks as always!</p>