log api errors when sending to sentry w/ burnettk
This commit is contained in:
parent
45eb61f974
commit
7f4c5befff
|
@ -175,6 +175,9 @@ def handle_exception(exception: Exception) -> flask.wrappers.Response:
|
||||||
if not isinstance(exception, ApiError) or exception.error_code != "invalid_token":
|
if not isinstance(exception, ApiError) or exception.error_code != "invalid_token":
|
||||||
id = capture_exception(exception)
|
id = capture_exception(exception)
|
||||||
|
|
||||||
|
if isinstance(exception, ApiError):
|
||||||
|
current_app.logger.error(f"Sending ApiError exception to sentry: {exception} with error code {exception.error_code}")
|
||||||
|
|
||||||
organization_slug = current_app.config.get("SENTRY_ORGANIZATION_SLUG")
|
organization_slug = current_app.config.get("SENTRY_ORGANIZATION_SLUG")
|
||||||
project_slug = current_app.config.get("SENTRY_PROJECT_SLUG")
|
project_slug = current_app.config.get("SENTRY_PROJECT_SLUG")
|
||||||
if organization_slug and project_slug:
|
if organization_slug and project_slug:
|
||||||
|
|
|
@ -295,7 +295,6 @@ def get_decoded_token(token: str) -> Optional[Dict]:
|
||||||
try:
|
try:
|
||||||
decoded_token = jwt.decode(token, options={"verify_signature": False})
|
decoded_token = jwt.decode(token, options={"verify_signature": False})
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
print(f"Exception in get_token_type: {e}")
|
|
||||||
raise ApiError(
|
raise ApiError(
|
||||||
error_code="invalid_token", message="Cannot decode token."
|
error_code="invalid_token", message="Cannot decode token."
|
||||||
) from e
|
) from e
|
||||||
|
|
Loading…
Reference in New Issue