user3052737
user3052737

Reputation: 13

Python - Catch error with specific code

in code I have this error

raise ClientError(response_data['data']['error'], response.status_code)
ClientError: (300) corrupt or not supported.

How to catch error 300?

try:
    somestuff

except ClientError:
    if error = 300:  # ?????
        print 'catched'
    else:
        just end the program

Thanks for your help.

Upvotes: 0

Views: 93

Answers (1)

Illusionist
Illusionist

Reputation: 5509

import errno

try:
  ..
except ClientError as serr:
    if serr.errno == 300:      
        raise serr

Upvotes: 1

Related Questions