Skip to content

Commit

Permalink
Reorder exceptions
Browse files Browse the repository at this point in the history
  • Loading branch information
kevinhu committed Mar 14, 2022
1 parent 1328526 commit 1195a3f
Showing 1 changed file with 12 additions and 11 deletions.
23 changes: 12 additions & 11 deletions metadata-ingestion/src/datahub/telemetry/telemetry.py
Original file line number Diff line number Diff line change
Expand Up @@ -194,17 +194,6 @@ def wrapper(*args: Any, **kwargs: Any) -> Any:
{"action": action, "status": "completed"},
)
return res
# Catch general exceptions
except Exception as e:
telemetry_instance.ping(
"function-call",
{
"action": action,
"status": "error",
"error": get_full_class_name(e),
},
)
raise e
# System exits (used in ingestion and Docker commands) are not caught by the exception handler,
# so we need to catch them here.
except SystemExit as e:
Expand Down Expand Up @@ -237,4 +226,16 @@ def wrapper(*args: Any, **kwargs: Any) -> Any:
)
sys.exit(0)

# Catch general exceptions
except Exception as e:
telemetry_instance.ping(
"function-call",
{
"action": action,
"status": "error",
"error": get_full_class_name(e),
},
)
raise e

return wrapper

0 comments on commit 1195a3f

Please sign in to comment.