From 55120740769176a4f6fcd0bc34b2c6c2244b289e Mon Sep 17 00:00:00 2001 From: Francesco Novy Date: Thu, 3 Jul 2025 15:57:17 +0200 Subject: [PATCH] feat(js): Add docs about serialization of captureException objects --- docs/platforms/javascript/common/apis.mdx | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/docs/platforms/javascript/common/apis.mdx b/docs/platforms/javascript/common/apis.mdx index d5e3f44f68504b..9d2a2486d8daab 100644 --- a/docs/platforms/javascript/common/apis.mdx +++ b/docs/platforms/javascript/common/apis.mdx @@ -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: + + ```javascript + Sentry.captureException({ prop1: "value1", prop2: "value2" }); + // --> "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. + { -## Instrumenting Server Routes +## Instrumenting Server Routes