API Reference
Types
ts
interface CapturedError {
error: unknown
message: string
stack?: string
componentName?: string
lifecycleHook?: string
source: 'render' | 'async' | 'event' | 'unhandledrejection' | 'manual'
timestamp: number
}
interface ErrorReporter {
report(error: CapturedError, context?: Record<string, unknown>): void | Promise<void>
destroy?(): void
}destroy?() is optional teardown for an adapter that holds a persistent listener/timer of its own — nothing in the package calls it automatically, so call it yourself when tearing down whatever owns the reporter. Only createHttpReporter implements it (removing its pagehide listener and force-flushing any pending batch); every other adapter has nothing persistent to release and omits it.
source notes:
'render'— a synchronous failure during a component's render or (sync)setup().'async'— anasync setup()that rejects after anawait. Vue reports both cases with the identical"setup function"info string, so this package additionally checks whether the component's ownsetupis anAsyncFunctionto tell them apart.'event'— a Vue-compiledv-onhandler (native DOM event or componentemit) that throws. Note: Vue does route these throughonErrorCaptured— what it genuinely can't see is covered in Error handling behavior.'unhandledrejection'/ and non-Vue'event's — only produced byuseGlobalErrorCapture().'manual'— the default forcaptureError()when nosourceis given.