JS SDK Reference (coming soon)
Exceptions

Exceptions

⚠️

Not available yet. The TracePath browser SDK is not published, so the capture API described here cannot be used today. To report errors from a backend, instrument it with OpenTelemetry: a span that records an exception arrives on the Issues page the same way a browser exception will.

An exception captured by the browser SDK carries three things: the error's type, its message, and its stack trace. Everything else — your own context — arrives as attributes.

What the type will be

The type shown in TracePath comes from the error's class name, not from a name property set on the instance. Minifiers rename classes, so in a production build a custom ValidationError reads as something like r: Invalid email format. Put anything you need to search or group on into the message or into attributes, not into the class name.

Pass real Error objects

The SDK reads a value's class name and its message property and nothing else, so anything that is not an Error loses information and arrives with no stack trace:

  • A bare string is stored as String: undefined; the string itself is lost.
  • A plain object is stored as Object: <its message property>; every other field is dropped.

Wrap the value in an Error and pass the extra fields as attributes instead.

Attribute values must be strings

The ingest endpoint types attributes as a string map (map[string]string on the wire), and rejects the whole upload with 400 Bad Request if any value is a number, boolean or object. The SDK re-queues a rejected batch and retries it, so one bad value blocks every later exception and message from that page too. Convert values to strings before attaching them. TypeScript catches this at compile time because the signature is Record<string, string>; plain JavaScript does not.

What to put in attributes

Do include:

  • User identifiers, anonymized if your policy requires it
  • Request, transaction or order IDs
  • Feature flags and A/B test variants
  • Business context that narrows the search: product ID, tenant, plan

Avoid including:

  • Secrets and PII: passwords, tokens, card numbers, health data
  • Large serialized objects or arrays — attributes are for filtering, not for payload dumps
  • Anything with circular references

Attributes appear as tags on the issue in the dashboard, which is how you filter a noisy issue down to the customer or the build that hit it.

React render errors

For React applications the React package's provider will double as an error boundary: render-time exceptions anywhere in the tree are captured and then re-thrown, so the app behaves exactly as it would without TracePath installed. See React for that integration and Error Boundary for the custom-fallback case.

Related

  • Initialization: filtering errors before they are captured
  • Source Maps: turning a minified stack trace back into your source — this half is live today