ref(server-utils): Set error attributes on span and simplify error info extraction#21822
Open
logaretm wants to merge 1 commit into
Open
ref(server-utils): Set error attributes on span and simplify error info extraction#21822logaretm wants to merge 1 commit into
logaretm wants to merge 1 commit into
Conversation
…butes on span Collapse the two branches of the thrown/rejected value handler into a single pass that derives the status message and `error.type` once, and set `error.type` / `sentry.status.message` attributes on the span alongside the error status. Add assertions covering Error instances, thrown primitives, bare error-like objects, and falsy throws.
Contributor
size-limit report 📦
|
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit b802211. Configure here.
| const isObject = !!error && typeof error === 'object'; | ||
| const raw = isObject ? ('message' in error ? error.message : undefined) : error; | ||
|
|
||
| const message = raw ? String(raw) : 'unknown_error'; |
There was a problem hiding this comment.
Empty Error message misclassified
Low Severity
getErrorInfo uses raw ? String(raw) : 'unknown_error', so when an Error has an empty message (e.g. new Error()), the span status and sentry.status.message become unknown_error instead of the empty string from .message, unlike the previous getErrorMessage logic and unlike nearby MySQL tracing-channel handling.
Reviewed by Cursor Bugbot for commit b802211. Configure here.
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.


When a traced operation throws or rejects, we now set
error.typeandsentry.status.messageattributes on the span alongside the existing error status, so the error type lines up with the rest of our span conventions.We talked about this yday, generally tracing channels allow us to observe more errors than before in some cases but these errors are not necessarily "unhandled", but we can still set the error attributes so our users can understand more about the op failure even if handled.