Capture & report errors
Use the Elysia client to report handled errors and finish sending events before short-lived work exits.
Capture exceptions
Rasputin captures uncaught errors automatically. Use captureException when you catch an error yourself
but still want Rasputin to report it. It accepts any thrown value and never throws. Bare captureException(error) reports the exception only.
To attach runtime recorder evidence, pass observation from scope.observeError(error).
try {
await chargeCustomer();
} catch (error) {
rasputin.captureException(error);
}Send pending events before exit
Rasputin sends events in the background. A script or serverless function can finish before that
happens, so call flush before it exits. Long-running
servers flush automatically.
await rasputin.flush();Client options
These are the fields you can pass to the RasputinInit client. Rasputin discovers source from package boundaries; root settings are optional.
| Field | Required | What it does |
|---|---|---|
dsn | Required | Public project DSN from project settings. Used only to send events. |
projectApiKey | Required | Secret project API key for deploy announcement and instrumentation manifest upload. |
environment | Required | Where the error happened, such as production or staging. |
release | Required | The Git commit SHA for this deployment. |
moduleUrl | Optional | Helps normalize local stack paths. Use import.meta.url. |
repoRoot | Optional | A local filesystem display root. It does not control source identity. |
sourceRoot | Optional | The Git folder for a single-package service when automatic matching is ambiguous. |
sourceRoots | Optional | Package-name to Git-folder mappings for an ambiguous monorepo. |
enabled | Optional | Turns reporting on or off. Defaults to true. |
logSuccess | Optional | Prints a configuration summary when setup succeeds. Defaults to true. |
executionRecorder | Optional | Optional. Does not change basic error reporting. Enables the runtime recorder so errors can include arguments, return values, and call history from the failing work. |
