Application errors
When the function you pass tostep() throws, the SDK automatically records an error event — capturing the error message and, if you have enabled captureStack, the stack trace — and then rethrows the original error unchanged. Your existing try/catch blocks, error boundaries, and error-handling middleware continue to work exactly as they did before you added instrumentation.
Telemetry errors
Sending events to Failpath is a network operation and can fail. By default, the SDK swallows telemetry errors so that a Failpath outage or network blip never disrupts your application. You have three options for controlling this behavior.Silent by default (throwOnSendError: false)
The default behavior. Telemetry send errors are suppressed entirely. Your application continues to run as if the SDK were not present.
Log errors with onError
Provide an onError callback to receive telemetry errors without causing them to propagate. This is the recommended approach for production — you get observability into SDK failures without any risk of impacting your users.
Throw on send errors (throwOnSendError: true)
Set throwOnSendError: true if you want the SDK to throw when a telemetry send fails. With the default background delivery mode, queued delivery errors surface from failpath.flush(). With delivery: "await", the individual recordStep() or step() call can throw. This is useful in integration tests or CI pipelines where you want to detect SDK misconfiguration early, but it is not recommended for production use.
Capturing stack traces
By default,captureStack is false and stack traces are not included in error events. Set it to true if you want the full stack trace attached to every error event the SDK records:
For unit and integration tests, prefer the mock client from
@failpath/sdk/testing when you want to assert which events your code emits. Use enabled: false when you only want instrumentation to be inert.