Report errors from the browser
The tracker reports errors from your pages. Ottertrail groups them, and the Errors page shows each group with its occurrences, the users it affects, and when it was first and last seen. See Resolving errors for the page, and How errors are grouped for the groups.
Errors the tracker reports by itself
Section titled “Errors the tracker reports by itself”- Uncaught exceptions on the page.
- Unhandled promise rejections. When the reason is an
Error, Ottertrail gets its name, message, and stack. Another value is reported with the typeUnhandledRejectionand no stack.
The tracker does not report these:
Script error.without a stack. The browser hides the details of errors in scripts from another origin. To see them, load those scripts withcrossorigin="anonymous", and send CORS headers from their server.- Errors that come from browser extensions.
- Errors that happen before the tracker runs. The tracker loads with
defer. - Failed images and scripts.
To turn automatic reports off, add data-errors="off" to the script tag. captureError() still works.
Report an error your app catches
Section titled “Report an error your app catches”Call captureError() with the error:
try { await saveCart(cart);} catch (error) { window.ottertrail?.captureError(error); showMessage("We could not save your cart.");}You can add properties, as for a custom event:
window.ottertrail?.captureError(error, { step: "checkout", plan: "team" });- Ottertrail marks these errors as handled. The error’s page shows them as Caught.
- If the value is not an
Error, Ottertrail reports it with the typeErrorand the value’s text as the message. - Properties follow the rules of custom event properties. See the tracker reference.
What each error carries
Section titled “What each error carries”Each error belongs to the page and the signed-in user of the moment it happened, with the environment and release of the page. It holds:
| Field | Limit |
|---|---|
Type, such as TypeError |
1 to 200 characters |
| Message | Up to 2,000 characters |
| Stack | Up to 16,000 characters |
The tracker cuts longer values to these limits.
Limits for each page load
Section titled “Limits for each page load”A broken page can throw the same error in a loop. So for each page load, the tracker sends:
- Each identical error (the same type, message, and stack) one time.
- 25 errors at most.
A navigation inside a single-page app does not start a new count.
Stacks from minified code
Section titled “Stacks from minified code”The stack of minified code points at the built files. Upload your source maps, and Ottertrail shows your own files and lines. See Upload source maps.