API exception

This commit is contained in:
Lucidiot 2018-10-20 18:57:02 +02:00
parent 352bab04b1
commit 566430aa55
No known key found for this signature in database
GPG Key ID: AE3F7205692FA205
1 changed files with 11 additions and 0 deletions

11
urbantz/exceptions.py Normal file
View File

@ -0,0 +1,11 @@
class APIError(Exception):
def __init__(self, error):
self.message = error.get('message')
self.code = error.get('code')
def __repr__(self):
return "<APIError '{}'>".format(str(self))
def __str__(self):
return self.message or 'Unknown error'