Developer pages

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
});
OptionDefaultRole
enableErrorTrackingtrueInstalls window listeners when start() runs
releaseunsetVersion stamped on every error report
environmentunsetStage tag for Issues filters
commitShaunsetEnables GitHub blob links for culprits
distunsetPairs with release for source-map lookup
captureRequestBodiesfalseAttach redacted bodies/headers on the last correlated request

Transport: POST /api/ingestion/errors with Authorization: Bearer <apiKey>.

What is captured automatically

MechanismSource
onerrorwindow error event (uncaught exceptions)
onunhandledrejectionUnhandled promise rejections
resourceCapture-phase resource load failures (img/script/link, etc.)
cspsecuritypolicyviolation 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);
}
ArgumentTypeNotes
errorunknownError, string, or other thrown value
options.componentStackstringReact component stack
options.mechanismErrorMechanismDefaults 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.

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

  1. In staging, throw a test error (uncaught or captureException).
  2. Open Issues → Runtime → status open.
  3. Confirm stack frames, release/environment, user/session metadata.
  4. Open a linked replay at the error offset.
  5. With source maps uploaded, confirm original file/line.