forked from p15670423/monkey
Agent: Simplify error handling in HTTPIslandAPIClient
This commit is contained in:
parent
1c6ca24a47
commit
417d167026
|
@ -35,14 +35,8 @@ def handle_island_errors(fn):
|
|||
def decorated(*args, **kwargs):
|
||||
try:
|
||||
return fn(*args, **kwargs)
|
||||
except (
|
||||
IslandAPIConnectionError,
|
||||
IslandAPIError,
|
||||
IslandAPIRequestError,
|
||||
IslandAPIRequestFailedError,
|
||||
IslandAPITimeoutError,
|
||||
) as e:
|
||||
raise e
|
||||
except IslandAPIError as err:
|
||||
raise err
|
||||
except (requests.exceptions.ConnectionError, requests.exceptions.TooManyRedirects) as err:
|
||||
raise IslandAPIConnectionError(err)
|
||||
except requests.exceptions.HTTPError as err:
|
||||
|
@ -67,8 +61,8 @@ def convert_json_error_to_island_api_error(fn):
|
|||
def wrapper(*args, **kwargs):
|
||||
try:
|
||||
fn(*args, **kwargs)
|
||||
except json.JSONDecodeError as e:
|
||||
raise IslandAPIRequestFailedError(e)
|
||||
except json.JSONDecodeError as err:
|
||||
raise IslandAPIRequestFailedError(err)
|
||||
|
||||
return wrapper
|
||||
|
||||
|
|
Loading…
Reference in New Issue