fix(sentry): carry the Throwable in swallowed-exception error logs across base - #137
Merged
Merged
Conversation
…ross base Completes the instrumentation sweep. sentry-laravel promotes a `context['exception']` that is a Throwable to captureException() (class + stacktrace + grouping); anything else arrives as a bare message that cannot be diagnosed — the defect behind #824/#847/#1035. 77 sites in 61 files, all of them catch-and-swallow paths in FleetQ's own logic: pipeline, workflow, crew, skill, project, chatbot, approval, listeners, console commands, controllers. DELIBERATELY LEFT ALONE — 34 sites where the failure is a third party, not a FleetQ defect, and a stacktrace-carrying issue would be pure noise: Signal/Connectors, Outbound/Connectors, Tool/Services (MCP clients), Infrastructure/Bridge, Telegram/Webhook/Integration delivery actions, plus the Helicone pricing fetch and the OpenAI embedding call. Also left: sites that rethrow (the framework handler already captures those — adding the key would duplicate the event). Every insertion was verified to bind the variable of its own enclosing catch or `failed(Throwable $exception)` parameter; three initial mismatches (Crew Execute/Validate jobs, SkillImprovementIterationJob) are fixed. Full base suite: 4856 passed. phpstan: no new errors.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Completes the instrumentation sweep behind #824 / #847 / #1035, which arrived at Sentry as bare messages — no exception class, no stacktrace, no context.
sentry-laravelpromotes acontext['exception']that is aThrowabletocaptureException(); anything else becomescaptureMessage():Scope: 77 sites, 61 files
All of them catch-and-swallow paths in FleetQ's own logic — pipeline, workflow, crew, skill, project, chatbot, approval, listeners, console commands, controllers. Where the log is the only thing Sentry ever sees, it now carries the Throwable.
Deliberately left alone
34 sites where the failure is a third party, not a FleetQ defect. A stacktrace-carrying issue there is pure noise, which is the opposite of the goal:
Domain/Signal/Connectors(24) ·Domain/Outbound/Connectors·Domain/Tool/Services(MCP clients) ·Infrastructure/Bridge· Telegram / Webhook / Integration delivery actions · the Helicone pricing fetch · the OpenAI embedding call.Sites that rethrow are also untouched — the framework handler already captures those, so adding the key would duplicate the event. Same reasoning as base
BaseStageJob, which keeps itsSentryEventCapturercall separate from the log.Correctness of a 77-site mechanical edit
The first pass used a line-window heuristic to find the enclosing
catch, which bound$ein threefailed(\Throwable $exception)methods where the catch above had already closed scope — phpstan caught them asUndefined variable: $e(Crew Execute/Validate jobs,SkillImprovementIterationJob). Fixed.Because phpstan only catches the case where the variable does not exist at all, every one of the 77 insertions was then verified programmatically to bind the variable of its own enclosing
catch (...)orfailed(Throwable $x)parameter. Zero mismatches remain.Verification
Webklex\PHPIMAPpackage + unrelated Mcp property access)