Sending errors

Overview

The observability plugin automatically sends errors to LaunchDarkly. You can also use recordError to manually send a custom error.

Details about each SDK’s configuration are available in the SDK-specific sections below:

Viewing errors and sourcemaps

You can view all errors sent to LaunchDarkly under Errors in the LaunchDarkly user interface. To learn more, read Error monitoring.

When you use the Errors page in LaunchDarkly to help debug an error, it’s helpful to have a stack trace from the original file in your codebase to help understand what is going wrong. To provide this, LaunchDarkly needs access to the sourcemaps from your codebase. You can send your sourcemaps to LaunchDarkly using the ldcli sourcemaps upload command in the LaunchDarkly CLI. To learn how, read Use ldcli for uploading sourcemaps.

Client-side SDKs

This feature is available in the observability plugin for the following client-side SDKs:

JavaScript

You can use recordError to manually send a custom error:

Record error
1LDObserve.recordError(error, 'optional message', {
2 component: 'ExampleComponent.tsx',
3});

The message and payload arguments are optional. To learn more, read recordError.

React Web

To send a custom error with the React Web SDK, follow the example for JavaScript.

Vue

To send a custom error with the React Web SDK, follow the example for JavaScript.