title: Should I raise a custom exception?
body: <p>Trying to figure out the most correct pythonic way to handle an error case.</p>
  
  <ul>
  <li>main.py - calls into a custom class call database_class located in database.py</li>
  <li><p>database.py - uses mysql.connector to make a connection, BUT if that database doesn't exist I catch the mysql exception and parse out if it's because of an unknown database. IE:</p>
  
  <pre><code>try:
  
      self.conn = mysql.connector.connect(host=host,
                                          database=db_name,
                                          user=username,
                                          password=password,
                                          port=port,
                                          charset='utf8')
  
      if self.conn.is_connected():
          self.logger.info("Connected to mysql database: {}".format(db_name))
  
  except mysql.connector.Error as err:
      if 'Unknown database' in str(err.msg):
          self.logger.error("The database does not yet exist I can't continue...")
  </code></pre>
  
  <p>raise</p></li>
  </ul>
  
  <p>The problem I have is the 'raise' if I just raise the error than main.py has to understand how to parse mysql exceptions and i'm trying to avoid that.  So should I create a custom exception handler here for my database_class?</p>