Skip to content

DIAGNOSTICS

A deeply frozen object of every code the framework reports. ToolkitDiagnosticCode is the exact union of its strings, plus any '<namespace>.<name>' a consumer reports.

js
import { 
DIAGNOSTICS
} from '@studiometa/js-toolkit';
DIAGNOSTICS
.
component
.
loadFailed
; // 'component.load-failed'
DIAGNOSTICS
.
responsive
.
unknownBreakpoint
; // 'responsive.unknown-breakpoint'

attribute

KeyCodeReported when
unknownQualifierattribute.unknown-qualifiera watched namespace with a finite vocabulary gets an unknown qualifier head

callback

Every one of these is reported and continued: the failing callback is skipped, the others run.

KeyCode
signalFailedcallback.signal-failed
contextSubscriptionFailedcallback.context-subscription-failed
contextTeardownFailedcallback.context-teardown-failed
attributeWatcherFailedcallback.attribute-watcher-failed
serviceFailedcallback.service-failed
schedulerTickFailedcallback.scheduler-tick-failed
scheduledTaskFailedcallback.scheduled-task-failed
domUpdateRunnerFailedcallback.dom-update-runner-failed
extendableEventExtensionFailedcallback.extendable-event-extension-failed

A scheduled task also rejects its own promise with the same value.

component

KeyCodeReported when
loadFailedcomponent.load-faileda lazy import fails — once per name, never retried
mountFailedcomponent.mount-faileda mount fails
lifecycleFailedcomponent.lifecycle-failedmounted() or unmounted() throws
invalidMountStrategycomponent.invalid-mount-strategya data-mount value is unusable — the component stays unmounted
invalidFamilyDeclarationcomponent.invalid-family-declarationa config.components value is neither a Base class nor a thunk
configConflictcomponent.config-conflict@component and static config declare one key differently

event

KeyCodeReported when
invalidEmitPayloadevent.invalid-emit-payload$emit() gets a payload that is not an object

The event still dispatches.

manifest

KeyCodeReported when
duplicateTokenmanifest.duplicate-tokena manifest declares a token already owned

option

KeyCodeReported when
literalDefaultoption.literal-defaultan Array or Object default is a literal, not a factory

The value is then used as declared and shared between instances.

protocol

KeyCodeReported when
lateRegistrationprotocol.late-registrationa negotiated-event listener calls wrap/waitUntil after dispatch
unappliedDomUpdateprotocol.unapplied-dom-updatea claimed runner resolves without calling apply

In both cases the change still happens.

ref

KeyCodeReported when
mismatchref.mismatchconfig.refs and data-ref disagree on the [] suffix — once per instance and ref

registry

KeyCodeReported when
conflictregistry.conflicta name is registered twice — the second is ignored
lazyNameMismatchregistry.lazy-name-mismatcha loaded class's config.name differs from its token

responsive

KeyCodeReported when
unknownBreakpointresponsive.unknown-breakpointa :<suffix> names no configured breakpoint — including the v3 list syntax

scheduler

KeyCodeReported when
backgroundPostFailedscheduler.background-post-faileda background turn cannot be posted

service

KeyCodeReported when
missingTargetservice.missing-targeta caller-supplied mixin target resolver returns undefined or nullno subscription starts

storage

KeyCodeReported when
accessFailedstorage.access-faileda provider's area is refused or full
serializeFailedstorage.serialize-failedserialization throws — nothing is written
deserializeFailedstorage.deserialize-faileddeserialization throws — the default is returned

swap

KeyCodeReported when
selfIgnoredswap.self-ignoredself is passed with append/prepend, or content holds no element

Consumer codes

ToolkitDiagnosticCode also accepts any `${string}.${string}`, so a consumer reports on the same channel with its own namespace:

ts
import { 
warn
} from '@studiometa/js-toolkit';
warn
('carousel.no-slides', 'A Carousel with no slide does nothing.', {
component
: 'Carousel' });

Import it on its own

js
import { 
DIAGNOSTICS
} from '@studiometa/js-toolkit/DIAGNOSTICS';

MIT Licensed