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
| Key | Code | Reported when |
|---|---|---|
unknownQualifier | attribute.unknown-qualifier | a 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.
| Key | Code |
|---|---|
signalFailed | callback.signal-failed |
contextSubscriptionFailed | callback.context-subscription-failed |
contextTeardownFailed | callback.context-teardown-failed |
attributeWatcherFailed | callback.attribute-watcher-failed |
serviceFailed | callback.service-failed |
schedulerTickFailed | callback.scheduler-tick-failed |
scheduledTaskFailed | callback.scheduled-task-failed |
domUpdateRunnerFailed | callback.dom-update-runner-failed |
extendableEventExtensionFailed | callback.extendable-event-extension-failed |
A scheduled task also rejects its own promise with the same value.
component
| Key | Code | Reported when |
|---|---|---|
loadFailed | component.load-failed | a lazy import fails — once per name, never retried |
mountFailed | component.mount-failed | a mount fails |
lifecycleFailed | component.lifecycle-failed | mounted() or unmounted() throws |
invalidMountStrategy | component.invalid-mount-strategy | a data-mount value is unusable — the component stays unmounted |
invalidFamilyDeclaration | component.invalid-family-declaration | a config.components value is neither a Base class nor a thunk |
configConflict | component.config-conflict | @component and static config declare one key differently |
event
| Key | Code | Reported when |
|---|---|---|
invalidEmitPayload | event.invalid-emit-payload | $emit() gets a payload that is not an object |
The event still dispatches.
manifest
| Key | Code | Reported when |
|---|---|---|
duplicateToken | manifest.duplicate-token | a manifest declares a token already owned |
option
| Key | Code | Reported when |
|---|---|---|
literalDefault | option.literal-default | an Array or Object default is a literal, not a factory |
The value is then used as declared and shared between instances.
protocol
| Key | Code | Reported when |
|---|---|---|
lateRegistration | protocol.late-registration | a negotiated-event listener calls wrap/waitUntil after dispatch |
unappliedDomUpdate | protocol.unapplied-dom-update | a claimed runner resolves without calling apply |
In both cases the change still happens.
ref
| Key | Code | Reported when |
|---|---|---|
mismatch | ref.mismatch | config.refs and data-ref disagree on the [] suffix — once per instance and ref |
registry
| Key | Code | Reported when |
|---|---|---|
conflict | registry.conflict | a name is registered twice — the second is ignored |
lazyNameMismatch | registry.lazy-name-mismatch | a loaded class's config.name differs from its token |
responsive
| Key | Code | Reported when |
|---|---|---|
unknownBreakpoint | responsive.unknown-breakpoint | a :<suffix> names no configured breakpoint — including the v3 list syntax |
scheduler
| Key | Code | Reported when |
|---|---|---|
backgroundPostFailed | scheduler.background-post-failed | a background turn cannot be posted |
service
| Key | Code | Reported when |
|---|---|---|
missingTarget | service.missing-target | a caller-supplied mixin target resolver returns undefined or null — no subscription starts |
storage
| Key | Code | Reported when |
|---|---|---|
accessFailed | storage.access-failed | a provider's area is refused or full |
serializeFailed | storage.serialize-failed | serialization throws — nothing is written |
deserializeFailed | storage.deserialize-failed | deserialization throws — the default is returned |
swap
| Key | Code | Reported when |
|---|---|---|
selfIgnored | swap.self-ignored | self 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';