A single captured exception, trimmed to what a bug report needs.
Renders an Error together with its cause chain (ES2022) into a single
stack string, so a wrapped error's root cause isn't lost. Non-Error causes
are stringified; the walk is depth-limited to guard against cyclic or
pathologically deep chains.
Reads the current ring buffer from session storage, tolerating a missing or malformed value by returning an empty list.
Appends one exception to the ring buffer, trimming to the most recent
MAX_ERRORS. Never throws — a failure to record must not cascade into
the code path that raised the original error. Writes are serialized so
concurrent captures don't clobber each other.
Records an arbitrary thrown value into the ring buffer, folding its cause
chain (and any AggregateError sub-errors) into the stored stack. Convenience
over recordError for callers that hold the raw error.
Registers global error and unhandledrejection listeners that push captured
exceptions into the ring buffer. Idempotent, and safe in both window and
service-worker contexts (both expose self with addEventListener).
Where a captured error originated: a global window/worker hook, an unhandled promise rejection, React's error hooks, or an aggregated supplier-search failure.