title: How do I catch exceptions that have specific error messages in Python?
body: <p>When I have two Python exceptions that are the same exception class but a different error message, how do I catch them separately? </p>
  
  <p>For specific use-case: 
  I'm using the <a href="https://github.com/jgorset/facepy" rel="nofollow">Facepy library</a> to hit the Facebook Graph API. When the API returns an error that isn't Oauth related, Facepy raises a <code>facepy.exceptions.FacebookError</code> and passes the error message given by the Facebook API. </p>
  
  <p>I'm consistently hitting two different errors that I'd like to treat differently and the only way to parse them is the error message, but I can't figure out how to write my <code>except</code> clause--here it is in pseudo-code:</p>
  
  <pre><code>try: 
      #api query
  
  except facepy.exceptions.OAuthError and error_message = 'object does not exist':
      # do something
  
  except facepy.exceptions.OAuthError and error_message = 'Hit API rate limit':
      # do something else
  </code></pre>
  
  <p>How do I write these <code>except</code> clauses to trigger off both the exception and the error message? </p>