If try except order change

pull/365/head
kompotkot 2021-11-04 13:03:18 +00:00
rodzic f8c7de63a0
commit 4f17dfa998
1 zmienionych plików z 15 dodań i 15 usunięć

Wyświetl plik

@ -42,22 +42,22 @@ async def add_subscription_handler(
"""
token = request.state.token
try:
if subscription_type_id != "ethereum_whalewatch":
if subscription_type_id != "ethereum_whalewatch":
try:
checksum_address = web3.toChecksumAddress(address)
except ValueError as e:
raise MoonstreamHTTPException(
status_code=400,
detail=str(e),
internal_error=e,
)
except Exception as e:
logger.error(f"Failed to convert address to checksum address")
raise MoonstreamHTTPException(
status_code=500,
internal_error=e,
detail="Currently unable to convert address to checksum address",
)
except ValueError as e:
raise MoonstreamHTTPException(
status_code=400,
detail=str(e),
internal_error=e,
)
except Exception as e:
logger.error(f"Failed to convert address to checksum address")
raise MoonstreamHTTPException(
status_code=500,
internal_error=e,
detail="Currently unable to convert address to checksum address",
)
active_subscription_types_response = subscription_types.list_subscription_types(
active_only=True