Error monitoring
Automatic crash capture, captureException, React helpers, release tags, and Issues.
Goal
Populate Issues (and Releases) with actionable runtime errors linked to sessions and replays.
Enable / disable
HumanBehaviorTracker.init(apiKey, {
enableErrorTracking: true, // default (opt-out)
release: "1.4.2",
environment: "production",
commitSha: process.env.NEXT_PUBLIC_GIT_SHA,
dist: "web",
captureRequestBodies: false, // opt-in
});| Option | Default | Role |
|---|---|---|
enableErrorTracking | true | Installs window listeners when start() runs |
release | unset | Version stamped on every error report |
environment | unset | Stage tag for Issues filters |
commitSha | unset | Enables GitHub blob links for culprits |
dist | unset | Pairs with release for source-map lookup |
captureRequestBodies | false | Attach redacted bodies/headers on the last correlated request |
Transport: POST /api/ingestion/errors with Authorization: Bearer <apiKey>.
What is captured automatically
| Mechanism | Source |
|---|---|
onerror | window error event (uncaught exceptions) |
onunhandledrejection | Unhandled promise rejections |
resource | Capture-phase resource load failures (img/script/link, etc.) |
csp | securitypolicyviolation events |
Client-side ignored noise (not reported):
- Opaque
Script error./Script error - ResizeObserver loop warnings
- Messages containing
humanbehavior error(SDK self-noise)
suppressConsoleErrors is separate — it only quiets narrow rrweb/CORS console messages and does not replace Issue Detection.
Manual capture
try {
risky();
} catch (error) {
tracker.captureException(error);
}| Argument | Type | Notes |
|---|---|---|
error | unknown | Error, string, or other thrown value |
options.componentStack | string | React component stack |
options.mechanism | ErrorMechanism | Defaults to 'captureException' |
ErrorMechanism values: onerror | onunhandledrejection | resource | csp | react | console | captureException.
Manual reports are marked handled: true. The method never throws into the host app. It is a no-op if error capture is not active (enableErrorTracking: false or before start).
React
import {
HumanBehaviorErrorBoundary,
captureNextError,
} from "humanbehavior-js/react";
<HumanBehaviorErrorBoundary fallback={<p>Something broke</p>}>
<App />
</HumanBehaviorErrorBoundary>HumanBehaviorErrorBoundary calls captureException with mechanism: 'react' and the component stack.
For Next.js App Router error.tsx / global-error.tsx (often outside the provider):
useEffect(() => {
captureNextError(error);
}, [error]);Limitation: browser/client route errors only. Server Component / RSC failures that never reach the browser are out of scope for this SDK.
Breadcrumbs & request context
Before an error is sent, the SDK attaches recent breadcrumbs (click / navigation / console / network) and, when available, the most recent network request within a 10s window. Bodies/headers appear only if captureRequestBodies: true (and are redacted).
Dedup
Client-side dedup collapses identical noise within a short window before send. Server-side fingerprinting groups occurrences into Issues.
Verify
- In staging, throw a test error (uncaught or
captureException). - Open Issues → Runtime → status open.
- Confirm stack frames, release/environment, user/session metadata.
- Open a linked replay at the error offset.
- With source maps uploaded, confirm original file/line.