You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
fix(errorsx): report the caller of the error handler - #5547
Errors logged through errorsx.SlogHandler showed pkg/errorsx/handler.go in the JSON log's caller field. Capture the file and line that called Handle or HandleContext so the log points to the code reporting the error.
Notes for reviewer
TestSlogHandlerCaller checks the exact file and line for both entry points. It failed against the previous implementation and passes with this change.
Tested with go test -tags=dynamic ./pkg/errorsx ./pkg/framework/transport/httptransport.
Summary by CodeRabbit
Bug Fixes
Cancellation errors are now reported as warnings when appropriate, while other errors retain their existing severity.
Error logs now include the caller’s source location and diagnostic details when available.
Confidence Score: 5/5
This PR appears safe to merge.
Summary
Updates SlogHandler to report the code that called Handle or HandleContext, rather than the handler itself.
Error logs now point to the code that reported them.
No actionable comments were generated in the recent review.
Walkthrough
SlogHandler.Handle and HandleContext now use a shared record-based logger. A test checks that each method records its caller’s file and line.
Changes: Slog error handling
Layer / File(s)
Summary
Record-based logging and caller validation pkg/errorsx/handler.go, pkg/errorsx/handler_test.go
Handle and HandleContext share logic that selects the log level and writes a timestamped record with caller details and diagnostic attributes. The new test checks the caller’s file and line in both methods’ JSON log records.
This change makes errors logged through the error handler report the file and line of the code that called it, instead of the handler's own file. The change is small and has a test for both entry points. I found no merge-blocking risk.
Pre-merge checks: 4
Check name
Status
Explanation
Description Check
Check skipped - CodeRabbit’s high-level summary is enabled.
Title check
The title names the main change: the error handler now reports the caller's file and line instead of pkg/errorsx/handler.go. The raw summary confirms Handle and HandleContext capture the call site, an…
Linked Issues check
Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check
Check skipped because no linked issues were found for this pull request.
Full details: Title check
Explanation
The title names the main change: the error handler now reports the caller's file and line instead of pkg/errorsx/handler.go. The raw summary confirms Handle and HandleContext capture the call site, and the test file adds TestSlogHandlerCaller to verify it. The title is specific and matches the changeset.
Finishing Touches
Generate unit tests (beta)
Commit to this branch
Create a new PR
Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.
Reviewing files that changed from the base of the PR and between 890e6dc and e41c16a.
Files selected for processing: 2
pkg/errorsx/handler.go
pkg/errorsx/handler_test.go
Included review availability: This review used your included allowance. Your plan provides up to 8 included reviews per hour; 6 remain after this review.
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
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.
Overview
Errors logged through
errorsx.SlogHandlershowedpkg/errorsx/handler.goin the JSON log'scallerfield. Capture the file and line that calledHandleorHandleContextso the log points to the code reporting the error.Notes for reviewer
TestSlogHandlerCallerchecks the exact file and line for both entry points. It failed against the previous implementation and passes with this change.Tested with
go test -tags=dynamic ./pkg/errorsx ./pkg/framework/transport/httptransport.Summary by CodeRabbit


Confidence Score: 5/5
This PR appears safe to merge.Summary
Updates
SlogHandlerto report the code that calledHandleorHandleContext, rather than the handler itself.Reviews (1) · Last reviewed commit: "fix(errorsx): report the caller of the e..." · Reviewed by Greptile