Skip to content

fix: capture method errors via captureError before ending transaction - #365

Merged
omegascorp merged 1 commit into
modelence:mainfrom
Kathircpe:fix/method-capture-error
Sep 8, 2026
Merged

omegascorp merged 1 commit into
modelence:mainfrom
Kathircpe:fix/method-capture-error

Conversation

@Kathircpe

@Kathircpe Kathircpe commented Sep 3, 2026 •

Copy link
Copy Markdown
Contributor

Summary

runMethod / runLiveMethod ended the transaction as 'error' but never reported the error itself, so failures were invisible in APM. This calls captureError() (normalizing non-Error throws) before transaction.end('error'), mirroring the cron-job pattern, and extends the methods/index tests to assert the capture on both paths.


Note

Low Risk
Observability-only change; errors are still rethrown and transaction behavior is unchanged aside from associating captured errors.

Overview
Method handlers already ended telemetry transactions as error on failure but did not record the exception, so APM showed failed transactions without the underlying error. runMethod and runLiveMethod now call captureError in their catch blocks (coercing non-Error throws to Error) before transaction.end('error'), matching the existing cron-job pattern.

Tests mock captureError and assert it runs alongside the error transaction end for both standard and live method execution paths.

Reviewed by Cursor Bugbot for commit 178f2c3. Bugbot is set up for automated code reviews on this repo. Configure here.

@omegascorp omegascorp left a comment •

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good, not merging yet, will do once 0.24.0 is released

@omegascorp
omegascorp merged commit cce66b7 into modelence:main Sep 8, 2026
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants