MCPcopy Index your code
hub / github.com/Codeplain-ai/codeplain / capture_crash

Function capture_crash

plain2code_telemetry.py:89–116  ·  view source on GitHub ↗

Report an unexpected crash to Sentry. Returns True if an event was sent.

(exc_info, run_state: Optional[RunState], args)

Source from the content-addressed store, hash-verified

87
88
89def capture_crash(exc_info, run_state: Optional[RunState], args) -> bool:
90 """Report an unexpected crash to Sentry. Returns True if an event was sent."""
91 if not telemetry_enabled():
92 return False
93
94 try:
95 with sentry_sdk.new_scope() as scope:
96 if run_state is not None:
97 scope.set_tag("render_id", run_state.render_id)
98 scope.set_tag("render_state", run_state.current_render_state)
99 scope.set_tag("current_module", run_state.current_module)
100 scope.set_tag("current_frid", run_state.current_frid)
101 if run_state.user_email:
102 scope.set_user({"email": run_state.user_email})
103 scope.set_tag("headless", bool(getattr(args, "headless", False)))
104 scope.set_tag("unittests_script_provided", bool(getattr(args, "unittests_script", None)))
105 scope.set_tag("conformance_tests_script_provided", bool(getattr(args, "conformance_tests_script", None)))
106 scope.set_tag(
107 "prepare_environment_script_provided", bool(getattr(args, "prepare_environment_script", None))
108 )
109
110 event_id = sentry_sdk.capture_exception(exc_info[1])
111
112 sentry_sdk.flush(timeout=FLUSH_TIMEOUT_SECONDS)
113 return event_id is not None
114 except Exception:
115 # Telemetry must never break the CLI or mask the original crash.
116 return False

Calls 1

telemetry_enabledFunction · 0.85