browser-sdk

Home > @datadog/browser-rum-react > addReactError

addReactError() function

Report an error originating from React (Error Boundary or componentDidCatch) to Datadog RUM. This helper should not be called directly; prefer to use the ErrorBoundary component or React’s error lifecycle.

Signature:

export declare function addReactError(error: Error, info: ErrorInfo): void;

Parameters

Parameter Type Description
error Error The JavaScript `Error` instance thrown by React.
info ErrorInfo Additional React error information, including the component stack.

Returns:

void