title: How does the python exception or base exception classes work?
body: <p>So I don't know if this is good practice, it probably is not but...</p>
  
  <p>I have a series of custom errors/warnings under a general error class which hands general stuff for them.</p>
  
  <pre><code>class Error(Exception):
      """Main error class."""
  
      def __init__(self, *args):
          """Passable args."""
          self.args = args
          return None
  
  class ValueOverwrite(Error):
      """When a value in a dictionary is overwriten."""
      pass
  
  class SaveOverwrite(Error):
      """When a file is overwriten"""
      pass
  </code></pre>
  
  <p>When you raise an error and catch it could can do what you want with it but what if you want to simplify it so you only need to raise it - changing what is executed/printed.</p>
  
  <p>When something is raised and not caught it prints something like this</p>
  
  <pre><code>Traceback (most recent call last):
    File ".\errortest.py", line 20, in &lt;module&gt;
      raise Error("my msg", "a", "v")
  __main__.Error: ('my msg', 'a', 'v')
  </code></pre>
  
  <p>I want to change what is printed here for these errors. Or at least the bit after <code>__main__.Error:</code>
  (I worked this out) 
  To do this my guess is I would need to overwrite one or more of the methods in the exception or baseexception classes but I don't know as looking around many sites, articles, python doc I can not find anything on it.
  The source code is here but it is in C, I kind of get some of it but I don't know what it all does or what the called functions are.
  There is literally no documentation on the code in them anywhere just things like built-in errors and how to make custom ones. </p>
  
  <p>I now don't think this is a good way to do it as even if you print something different it will still break following the code?</p>
  
  <p>How should I do it? or where are the modules with these classes in?
  Or just stick to something like this:</p>
  
  <pre><code>try:
      raise Error("my msg", "a", "v")
  except Error as e:
      print(e.args[0])
  </code></pre>