mirror of
https://gitlab.com/RemixDev/deezer-py.git
synced 2024-12-28 18:36:23 +00:00
Added more infos to APIErrors
This commit is contained in:
parent
2b4fab5f19
commit
1834a87378
|
@ -4,7 +4,7 @@ from deezer.gw import GW
|
|||
from deezer.api import API
|
||||
import json
|
||||
|
||||
__version__ = "0.0.5"
|
||||
__version__ = "0.0.6"
|
||||
|
||||
class TrackFormats():
|
||||
"""Number associtation for formats"""
|
||||
|
|
|
@ -39,14 +39,14 @@ class API:
|
|||
if result_json['error']['code'] in [4, 700]:
|
||||
eventlet.sleep(5)
|
||||
return self.api_call(method, args)
|
||||
if result_json['error']['code'] == 100: raise ItemsLimitExceededException
|
||||
if result_json['error']['code'] == 200: raise PermissionException
|
||||
if result_json['error']['code'] == 300: raise InvalidTokenException
|
||||
if result_json['error']['code'] == 500: raise WrongParameterException
|
||||
if result_json['error']['code'] == 501: raise MissingParameterException
|
||||
if result_json['error']['code'] == 600: raise InvalidQueryException
|
||||
if result_json['error']['code'] == 800: raise DataException
|
||||
if result_json['error']['code'] == 901: raise IndividualAccountChangedNotAllowedException
|
||||
if result_json['error']['code'] == 100: raise ItemsLimitExceededException(f"ItemsLimitExceededException: {method}")
|
||||
if result_json['error']['code'] == 200: raise PermissionException(f"PermissionException: {method}")
|
||||
if result_json['error']['code'] == 300: raise InvalidTokenException(f"InvalidTokenException: {method}")
|
||||
if result_json['error']['code'] == 500: raise WrongParameterException(f"ParameterException: {method}")
|
||||
if result_json['error']['code'] == 501: raise MissingParameterException(f"MissingParameterException: {method}")
|
||||
if result_json['error']['code'] == 600: raise InvalidQueryException(f"InvalidQueryException: {method}")
|
||||
if result_json['error']['code'] == 800: raise DataException(f"DataException: {method}")
|
||||
if result_json['error']['code'] == 901: raise IndividualAccountChangedNotAllowedException(f"IndividualAccountChangedNotAllowedException: {method}")
|
||||
raise APIError(json.dumps(result_json['error']))
|
||||
return result_json
|
||||
|
||||
|
|
Loading…
Reference in a new issue