title: How to catch specific exceptions on sqlalchemy?
body: <p>I want to catch specific exceptions like <code>UniqueViolation</code> on sqlalchemy.</p>
  
  <p>But sqlalchemy throw exceptions only through <code>IntegrityError</code>.</p>
  
  <p>So I catched specific exceptions with below code.</p>
  
  <pre><code>except sqlalchemy.exc.IntegrityError as e:
      from psycopg2 import errors
      if isinstance(e.orig, errors.UniqueViolation):
          pass
      elif isinstance(e.orig, errors.ForeignKeyViolation):
          pass
  </code></pre>
  
  <p>But it looks doesn't elegant.</p>
  
  <p>I don't want to using if statement just catch with specific exception name.</p>
  
  <p>Is there any way to solve this issue?</p>
  
  <p>Thanks.</p>