Introduction
Lerix captures errors from your Next.js app so you can debug issues faster. After you complete the Next.js installation, useuseLerix().throwError() to send custom errors to your dashboard —
uncaught errors are captured automatically, with no extra code required.
Make sure your app is wrapped in
LerixNextProvider before reporting errors.Report an error
Parameters
BugType values
BugSeverity values
Automatic error capture
LerixNextProvider installs error capture two ways, so nothing needs wrapping in a try/catch for baseline coverage:
LerixErrorBoundarycatches errors thrown during rendering — React’s error boundary contract only covers the render phase, not event handlers or async code.- Global
window.onerrorandunhandledrejectionlisteners catch everything else.
LerixErrorBoundary still catches render errors regardless):
Next.js’s own error boundaries
LerixErrorBoundary only catches errors below where you place it. For
errors above that point — most notably in the root layout itself — Next.js
requires its own file-based error boundaries (error.tsx, global-error.tsx).
Call reportCaughtError directly inside those instead:
app/error.tsx
Automatic stack capture
When you callthrowError() 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 back to the original source file and line, using the build’s own
source map — including Turbopack’s sectioned source map format. 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.