On this page
Overview
Normalizes global errors/rejections, assigns occurrence identifiers, persists a ledger, and performs bounded delivery.
- Artifact
Errors.js· esm - Classification
public first party - Availability
Browser / native WebView hybrid - Normalization
Incident records normalized; storage/mail failures isolated.
Import and lifecycle
import * as module from '/arcane/modules/Errors.js';
Browser import auto-installs one global handler, listens for global errors and rejections, assigns occurrence identifiers, persists pending delivery in sessionStorage, may show a developer modal and send bounded mail notifications, and destroy removes listeners, UI, and timers.
Application-facing behavior: Global error event/code/reason constants; default Errors; event normalizers plus lifecycle, capture, delivery, state-free compatibility observation, and teardown methods.
Protocol and host implementation
Window error input, DBOPFS, Mail, and per-realm globalThis.arcaneEvents authority This detail does not widen the application-facing API or grant authority.
Exports, signatures, parameters, and results
| Binding | Form | Declaration or signature | Parameter syntax |
|---|---|---|---|
GLOBAL_ERROR_EVENT_TYPES | variable · value | variable GLOBAL_ERROR_EVENT_TYPES | — |
GLOBAL_ERROR_EVENT_CODES | variable · value | variable GLOBAL_ERROR_EVENT_CODES | — |
GLOBAL_ERROR_REASONS | variable · value | variable GLOBAL_ERROR_REASONS | — |
normalizeErrorEvent | function | function normalizeErrorEvent(event={},target=globalThis.window) | event={},target=globalThis.window |
normalizeRejectionEvent | function | function normalizeRejectionEvent(event={},target=globalThis.window) | event={},target=globalThis.window |
default | default · class | class Errors | — |
| Member | Kind | Exact public declaration | Parameter syntax |
|---|---|---|---|
Errors.constructor | constructor | constructor(options={}) | options={} |
Errors.loadLedger | method | loadLedger() | — |
Errors.persistLedger | method | persistLedger() | — |
Errors.cancelTimer | method | cancelTimer(record) | record |
Errors.scheduleRecord | method | scheduleRecord(record,delayMs) | record,delayMs |
Errors.restorePending | method | restorePending(records) | records |
Errors.warn | method | warn(message,error) | message,error |
Errors.onError | method | onError(event) | event |
Errors.onRejection | method | onRejection(event) | event |
Errors.readDeveloperMode | method | readDeveloperMode() | — |
Errors.waitForDeveloperPreference | method | waitForDeveloperPreference() | — |
Errors.onUserLoaded | method | onUserLoaded() | — |
Errors.drainDeveloperIncidents | method | drainDeveloperIncidents() | — |
Errors.offerDeveloperIncident | method | offerDeveloperIncident(incident,occurrenceId) | incident,occurrenceId |
Errors.capture | method | capture(incident) | incident |
Errors.flushOccurrence | method | flushOccurrence(occurrenceId) | occurrenceId |
Errors.buildNotification | method | buildNotification(record) | record |
Errors.deliver | async method | async deliver(record) | record |
Errors.flush | async method | async flush() | — |
Errors.whenIdle | async method | async whenIdle() | — |
Errors.destroy | method | destroy() | — |
Parameter meanings and results
normalizeErrorEvent and normalizeRejectionEvent return bounded incident records. Errors(options) supports capture, flush, whenIdle, and destroy with injectable clock, storage, scheduler, mail, and developer UI.
Events, side effects, and errors
Source-literal CustomEvent dispatches
No source-literal CustomEvent dispatch is part of this artifact.
Lifecycle and event flow
- consumes error
- consumes unhandledrejection
- consumes user-entity-loaded
Direct coded failures
This artifact directly assigns no stable coded failure.
Exported Error subclasses
This artifact exports no Error subclass.
Documented failure behavior
- constructor TypeError without an EventTarget
- delivery, storage, and UI failures are isolated and warned without retry
Availability and capabilities
Browser / native WebView hybrid. Incident records normalized; storage/mail failures isolated.
Browser and native-WebView global error containment; optional Mail and DBOPFS components are app services, not Core requirements.
Contract example
import {normalizeErrorEvent} from '/arcane/modules/Errors.js';
const incident=normalizeErrorEvent({
message:'Boom',
filename:'/app.js',
lineno:7,
colno:3
},{location:{pathname:'/app'}});
console.log(incident);
Related reference
No direct Core call is claimed for this artifact. Any injected provider or consuming module retains its own documented authority.