Capability first · transport second

Errors.js

Normalizes global errors/rejections, assigns occurrence identifiers, persists a ledger, and performs bounded delivery.

SDK 0.5.18Runtime 0.8.12Protocol arcane/1
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

JavaScript
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

BindingFormDeclaration or signatureParameter syntax
GLOBAL_ERROR_EVENT_TYPESvariable · valuevariable GLOBAL_ERROR_EVENT_TYPES
GLOBAL_ERROR_EVENT_CODESvariable · valuevariable GLOBAL_ERROR_EVENT_CODES
GLOBAL_ERROR_REASONSvariable · valuevariable GLOBAL_ERROR_REASONS
normalizeErrorEventfunctionfunction normalizeErrorEvent(event={},target=globalThis.window)event={},target=globalThis.window
normalizeRejectionEventfunctionfunction normalizeRejectionEvent(event={},target=globalThis.window)event={},target=globalThis.window
defaultdefault · classclass Errors
MemberKindExact public declarationParameter syntax
Errors.constructorconstructorconstructor(options={})options={}
Errors.loadLedgermethodloadLedger()
Errors.persistLedgermethodpersistLedger()
Errors.cancelTimermethodcancelTimer(record)record
Errors.scheduleRecordmethodscheduleRecord(record,delayMs)record,delayMs
Errors.restorePendingmethodrestorePending(records)records
Errors.warnmethodwarn(message,error)message,error
Errors.onErrormethodonError(event)event
Errors.onRejectionmethodonRejection(event)event
Errors.readDeveloperModemethodreadDeveloperMode()
Errors.waitForDeveloperPreferencemethodwaitForDeveloperPreference()
Errors.onUserLoadedmethodonUserLoaded()
Errors.drainDeveloperIncidentsmethoddrainDeveloperIncidents()
Errors.offerDeveloperIncidentmethodofferDeveloperIncident(incident,occurrenceId)incident,occurrenceId
Errors.capturemethodcapture(incident)incident
Errors.flushOccurrencemethodflushOccurrence(occurrenceId)occurrenceId
Errors.buildNotificationmethodbuildNotification(record)record
Errors.deliverasync methodasync deliver(record)record
Errors.flushasync methodasync flush()
Errors.whenIdleasync methodasync whenIdle()
Errors.destroymethoddestroy()

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

JavaScript
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);

No direct Core call is claimed for this artifact. Any injected provider or consuming module retains its own documented authority.