-
-
Notifications
You must be signed in to change notification settings - Fork 1.6k
feat(js): Add docs about serialization of captureException objects #14256
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Conversation
The latest updates on your projects. Learn more about Vercel for Git ↗︎
1 Skipped Deployment
|
Bundle ReportChanges will increase total bundle size by 180 bytes (0.0%) ⬆️. This is within the configured threshold ✅ Detailed changes
Affected Assets, Files, and Routes:view changes for bundle: sentry-docs-client-array-pushAssets Changed:
view changes for bundle: sentry-docs-server-cjsAssets Changed:
|
// --> "Object captured as exception with keys: prop1, prop2" | ||
``` | ||
|
||
Note that built-in objects may be serialized differently. If you want to capture objects in a specific way, you can use the `captureContext` parameter to attach additional data to the event. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe provide an example for the HTTP Response objects for demonstration? Would also help LLMs as a 1-shot prompt 😅
@@ -239,6 +239,16 @@ more information on how to use integrations. | |||
only `Error` objects, but also other objects as `exception` - in that case, | |||
the SDK will attempt to serialize the object for you, and the stack trace will | |||
be generated by the SDK and may be less accurate. | |||
|
|||
Please note that the serialization of objects may not be perfect, as it works based on simple heuristics. Objects that are not `Error` objects will be generally be serialized as follows: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please note that the serialization of objects may not be perfect, as it works based on simple heuristics. Objects that are not `Error` objects will be generally be serialized as follows: | |
Please note that the serialization of objects may not be perfect, as it's based on simple heuristics. Objects that are not `Error` objects will be generally be serialized as follows: |
|
||
```javascript | ||
Sentry.captureException({ prop1: "value1", prop2: "value2" }); | ||
// --> "Object captured as exception with keys: prop1, prop2" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
// --> "Object captured as exception with keys: prop1, prop2" | |
// --> "Object captured as an exception with keys: prop1, prop2" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
This adds docs explaining how
captureException
handles different kinds of objects.Closes https://linear.app/getsentry/issue/FE-507/improve-js-sdk-based-on-user-feedback