Skip to main content

Introduction

Lerix captures errors from your Angular app so you can debug issues faster. After you complete the Angular installation, use LerixService.throwError() to send custom errors to your dashboard — uncaught errors are captured automatically, with no extra code required.
Make sure you have registered the SDK with provideLerix() before reporting errors.

Report an error

Parameters

BugType values

BugSeverity values

Automatic error capture

provideLerix() installs error capture two ways, so nothing needs wrapping in a try/catch for baseline coverage:
  • A custom Angular ErrorHandler catches anything thrown inside Angular’s zone — template bindings, component lifecycle hooks, RxJS subscriptions.
  • Global window.onerror and unhandledrejection listeners catch everything else.
Unlike a native mobile crash handler, a browser tab isn’t about to terminate when one of these fires, so the report is sent immediately rather than persisted for the next launch. To disable both (e.g. if your app already has its own error reporting and you only want manual throwError calls):

Automatic stack capture

When you call throwError() without a stack argument, one is captured automatically from the call site — you only need to pass one explicitly when reporting a caught Error’s own stack instead (e.g. error.stack?.split('\n')). Either way, every stack frame is resolved from its compiled/bundled position (e.g. main.js:577:15) back to the original source file and line, using the build’s own source map — the same mechanism browser DevTools use to show you readable stack traces instead of minified bundle positions. This happens automatically; there’s nothing to configure.
Resolution requires a source map to be reachable at the frame’s URL — always true in development, and true in production only if your build serves its .map files publicly. If your production build keeps source maps private (a common choice), frames fall back to their compiled position rather than failing to report — resolution is best-effort and never blocks or delays the report itself.
To get readable production stack traces while keeping your source maps private, upload them to Lerix after each build. See Angular source maps.

Verify the integration

Then open your dashboard — the error should appear within seconds, with a resolved stack trace pointing at this exact line.