title: Passing arguments into a custom exception
body: <p>I've learned recently how to create custom exceptions in Python and implement them into a class. I'm trying to add an additional argument into my exception for more clarity, and can't seem to get the formatting done correctly.</p>
  
  <p>Here's what I'm attempting:</p>
  
  <pre><code>class NonIntError(Exception):
      pass
  
  class intlist(List):
  
      def __init__(self, lst = []):
  
          for item in lst:
              #throws error if list contains something other that int
              if type(item) != int:
                  raise NonIntError(item, 'not an int') 
  
              else:
                  self.append(item)
  </code></pre>
  
  <p>Expected Results</p>
  
  <pre><code>il = intlist([1,2,3,'apple'])
  
  &gt;&gt;&gt; NonIntError: apple not an int
  </code></pre>
  
  <p>Results with error</p>
  
  <pre><code>il = intlist([1,2,3,'apple'])
  
  &gt;&gt;&gt; NonIntError: ('apple', 'not an int')
  </code></pre>
  
  <p>Restating my question, I would like know how to make my exception appear like the expected results.</p>