Capture & report errors
Use the browser client to report handled errors and finish sending events when the tab hides.
Capture exceptions
Uncaught errors and unhandled rejections report automatically. Call captureException for errors you handle yourself.
try {
await checkout();
} catch (error) {
rasputin.captureException(error);
}Flush pending events
Rasputin sends events in the background. Flush when the tab is hidden so a close or navigation does not drop the last batch. The client also flushes on its own during normal use.
document.addEventListener('visibilitychange', () => {
if (document.visibilityState === 'hidden') {
void rasputin.flush();
}
});Client options
These are the fields you pass to the browser RasputinInit client. The Vite plugin does not fill
them in. Never pass a project API key here.
| Field | Required | What it does |
|---|---|---|
dsn | Required | Public project DSN from project settings. Safe to include in frontend env. |
environment | Required | Where the error happened, such as production or staging. |
release | Required | The Git commit SHA for this build. |
enabled | Optional | Turns reporting on or off. Defaults to true. |
logSuccess | Optional | Prints a configuration summary when setup succeeds. Defaults to true. |
scrubPII | Optional | When true, ingest also redacts personal data such as names, emails, and phone numbers from stored runtime state. Authentication secrets are always redacted. Set to false to keep personal data in captured values. Defaults to true. |
installGlobalHandlers | Optional | Observe window error and unhandledrejection. Defaults to true. |
apiUrl | Optional | Override the API origin from the DSN. Leave unset unless you self-host. |
