Error Reporting
Flashduty RUM Error Reporting
Overview
Error Types
JavaScript Errors
Network Errors
Resource Loading Errors
Custom Errors
Reporting Methods
Automatic Error Capture
TypeError
, ReferenceError
)..catch()
.提示
network
source) are filtered to avoid data pollution.Manual Error Reporting
addError
API, you can manually report handled exceptions, custom errors, or other errors not automatically captured. Manual reporting is suitable for the following scenarios:Example: Reporting Custom Errors
Example: Reporting Network Errors
Example: Reporting Handled Exceptions
React Error Boundary Integration
addError
API in componentDidCatch
, attaching component stack information for debugging.Example: React Error Boundary
Usage
Error Data Structure
Property | Type | Description |
---|---|---|
error.source | string | Error source (such as console , network , custom , source , report ). |
error.type | string | Error type or error code (such as TypeError , NetworkError ). |
error.message | string | Concise, highly readable error message. |
error.stack | string | Error stack trace or supplementary information. |
error.causes | Array | List of associated errors providing additional context (optional). |
context | Object | Custom contextual information (such as page state, user ID), passed through addError . |
Error Filtering and Configuration
source
as custom
, source
, report
, or console
.network
sources.beforeSend
callback to customize error handling logic, filter or modify error data.Example: Custom Error Filtering
FAQ and Best Practices
FAQ
1.
sourcemap
is correctly uploaded; if not, the stack may not be properly resolved.2.
beforeSend
callback to filter specific error sources or messages.
3.
fingerprint
property is correctly set and its value is a string.beforeSend
callback is being correctly called.Best Practices
1.
addError
to facilitate problem localization.{ userId: "12345", action: "submit_form" }
.2.
3.
beforeSend
to filter low-value errors and avoid data overload.4.