Skip to main content
This document covers exception types, capture mechanisms, manual reporting methods, React integration, and the data structure definition for reported exceptions.

Exception Types

RUM can monitor the following types of exceptions:
Includes code syntax errors, runtime exceptions, and unhandled Promise rejections. These issues can cause page functionality to fail, severely affecting user experience.

Reporting Methods

Automatic Error Capture

RUM SDK automatically captures the following types of browser errors:
  • Automatically captured errors include stack traces, error messages, and source information by default.
  • Errors from browser extensions or third-party scripts (such as network source) are filtered to avoid data pollution.

Manual Error Reporting

Through the addError API, you can manually report handled exceptions, custom errors, or other errors not automatically captured. Applicable Scenarios:
  • Log handled errors in business logic
  • Attach context information (such as user ID, page state) for troubleshooting
  • Monitor exceptions from third-party services or asynchronous operations

React Error Boundary Integration

RUM supports capturing component rendering errors through React Error Boundaries and reporting error information. You can call the addError API in componentDidCatch, attaching component stack information for debugging.
1

Create Error Boundary Component

2

Wrap Components with Error Boundary

Error Data Structure

Each error record contains the following attributes to describe error details and context:
string
Error source (e.g., console, network, custom, source, report)
string
Error type or error code (e.g., TypeError, NetworkError)
string
Concise, readable error message
string
Error stack trace or supplementary information
Array
List of related errors providing additional context (optional)
Object
Custom context information (e.g., page state, user ID), passed via addError

Error Filtering and Configuration

To ensure accuracy and relevance of error data, RUM applies the following filtering rules:
  • Only processes errors with source of custom, source, report, or console
  • Ignores irrelevant errors from browser extensions, third-party scripts, or network source
Errors must contain stack trace information, otherwise they may be ignored
Use beforeSend callback to customize error handling logic, filtering or modifying error data

Custom Error Filtering Example

FAQ

  • Confirm stack trace is complete, or check if custom fingerprints conflict
  • Check if sourcemap is correctly uploaded; if not, stacks may not be parsed correctly
Use beforeSend callback to filter specific error sources or messages:
  • Ensure fingerprint attribute is correctly set and value is a string
  • Check if beforeSend callback is being called correctly

Best Practices

Enrich Context Information

Attach business-related context in addError (such as user ID, action type) for easier problem location.Example: { userId: "12345", action: "submit_form" }

Optimize Error Boundaries

Configure error boundaries for key React components to ensure rendering errors are captured. Record component names and versions for easier issue tracking.

Control Error Volume

Use sampling rates or beforeSend to filter low-value errors and avoid data overload. Prioritize monitoring critical errors affecting user experience.

Analysis & Visualization

View error data trends and distribution in the “Insights” - “Exception Analysis” Tab to resolve key exception issues.

Next Steps

View Exceptions

Learn how to view and analyze Issues in the error tracking module