Skip to main content

Variable: NubbinIssueCode

const NubbinIssueCode: object

Defined in: packages/core/src/NubbinIssueCode.ts:29

Every reason Nubbin refuses something, as a value to branch on rather than a string to match. Compare it against NubbinIssue.code or NubbinError.code; a typo in a member name is a compile error, where a typo in a string literal is a branch that never runs.

Each member's value is its own name in kebab-case, so a serialized issue reads the same in a log as it does in code. Scripts and editors match on these names, so every member below says what raises it and what has to change to satisfy it.

Type Declaration​

ArtifactNotStored​

readonly ArtifactNotStored: "artifact-not-stored" = "artifact-not-stored"

A publish names a hash the store does not hold. Write the artifact before pointing a route at it.

BlockNotLoaded​

readonly BlockNotLoaded: "block-not-loaded" = "block-not-loaded"

@nubbin/react: the block registry has no importer for a block the artifact names.

BlockVersion​

readonly BlockVersion: "block-version" = "block-version"

defineBlock was given a version that is not an integer of 1 or more.

Cycle​

readonly Cycle: "cycle" = "cycle"

A node reaches back to one of its own ancestors, so the graph cannot flatten into a tree.

DanglingChild​

readonly DanglingChild: "dangling-child" = "dangling-child"

A slot or a roots entry references an id that elements does not hold.

DuplicateBlockName​

readonly DuplicateBlockName: "duplicate-block-name" = "duplicate-block-name"

createRegistry was given two blocks claiming one name — the identity every node resolves through.

DuplicateNodeId​

readonly DuplicateNodeId: "duplicate-node-id" = "duplicate-node-id"

addNode was given an id the document already uses. Reusing one would replace a node and redirect every slot that named it.

HintNotAddressable​

readonly HintNotAddressable: "hint-not-addressable" = "hint-not-addressable"

defineCatalog found a data hint with no single target: a path through [], which names every member of an array, or two hints whose paths nest and would write one value twice.

HintPathUnresolvable​

readonly HintPathUnresolvable: "hint-path-unresolvable" = "hint-path-unresolvable"

defineCatalog found ui.fields naming a path the schema does not define. Check the spelling against the schema.

InvalidDefaults​

readonly InvalidDefaults: "invalid-defaults" = "invalid-defaults"

defineCatalog found an entry's defaults do not satisfy that entry's own schema.

InvalidProps​

readonly InvalidProps: "invalid-props" = "invalid-props"

A node's props failed its schema, or parsed to something other than an object. path names the offending field.

InvalidRoute​

readonly InvalidRoute: "invalid-route" = "invalid-route"

A route no request could match — no leading slash, a trailing slash, an empty or malformed segment, or a * that is not the last one. Raised by compile and by parseMatchKind.

NoHoleResolver​

readonly NoHoleResolver: "no-hole-resolver" = "no-hole-resolver"

@nubbin/react: a node declares holes and the render was given no resolveHole.

NoJsonSchema​

readonly NoJsonSchema: "no-json-schema" = "no-json-schema"

A schema exposes no Standard JSON Schema converter, which field introspection needs — the studio reads a block's fields through it.

NoRoots​

readonly NoRoots: "no-roots" = "no-roots"

The document's roots is empty, so it names no entry element and there is no tree to build.

NoSuchNode​

readonly NoSuchNode: "no-such-node" = "no-such-node"

setNodeProp, addNode, removeNode or moveNode named a node id no element backs.

NotOneHostElement​

readonly NotOneHostElement: "not-one-host-element" = "not-one-host-element"

@nubbin/react: a block returned a Fragment, a composite, or several roots where one host element is required.

NotStandardSchema​

readonly NotStandardSchema: "not-standard-schema" = "not-standard-schema"

A schema exposes no ~standard.validate, or answers with a promise. Validation is synchronous at registration and at compile, so an async validator is refused rather than awaited.

PathNotAddressable​

readonly PathNotAddressable: "path-not-addressable" = "path-not-addressable"

A prop path with no single target: an empty segment, an [], or a descent into an array. Raised by setAtPath and by setNodeProp.

SlotAllowUnknown​

readonly SlotAllowUnknown: "slot-allow-unknown" = "slot-allow-unknown"

createRegistry found a slot's allow naming a block no registered block answers to.

SlotBounds​

readonly SlotBounds: "slot-bounds" = "slot-bounds"

defineBlock was given a slot whose min is above its max, which no composition satisfies.

SlotMax​

readonly SlotMax: "slot-max" = "slot-max"

A slot holds more children than its max.

SlotMin​

readonly SlotMin: "slot-min" = "slot-min"

A slot holds fewer children than its min. An omitted slot holds zero.

SlotNotAllowed​

readonly SlotNotAllowed: "slot-not-allowed" = "slot-not-allowed"

A slot the block never declared, or a child the slot's allow list rejects.

UnknownBlock​

readonly UnknownBlock: "unknown-block" = "unknown-block"

A node names a block neither the registry nor the catalog holds. Register the block, or correct the node's block.

UnknownProp​

readonly UnknownProp: "unknown-prop" = "unknown-prop"

A key the author wrote and the schema did not keep — almost always a typo, heading where the schema says headline. Returned in CompileResult.issues, never thrown: the artifact is valid and publishable without that key.

Unreachable​

readonly Unreachable: "unreachable" = "unreachable"

No slot reaches the node from any root, so it would be dropped silently on compile.

Example​

import { NubbinError, NubbinIssueCode } from "@nubbin/core";

try {
addNode(version, "section-1", "items", node);
} catch (error) {
if (error instanceof NubbinError && error.code === NubbinIssueCode.SlotMax) {
toast(`That slot is full: ${error.issues[0]?.at}`);
}
}