Documentation
¶
Overview ¶
Package yaml declares the error codes and the sentinels of the YAML codec, internal/service/data/codec/yaml — range 0.3.4.* (ADR 0005 service/data/codec/yaml block).
The codes live in the core at the path that mirrors the package emitting them (ADR 0160 §2) and keep the values they were allocated with: the LL byte 3 records the layer that allocated the range, not the directory that declares it today (ADR 0160 §3). Nothing here encodes or decodes — the mechanism, and the constructors that attach a failure's detail, stay in the service package.
Package yaml — the sentinel *errs.Error values, one per code. Each Reason derives from its var name or from its Code constant (ADR 0020); the Public and Private texts are the ones the service package always emitted, so moving the declaration changed no rendering.
Index ¶
Constants ¶
const CodeYAMLAliasRefused errs.Code = 0x00_03_04_04 // 0.3.4.4
CodeYAMLAliasRefused identifies an alias (*name): outside the subset.
const CodeYAMLAnchorRefused errs.Code = 0x00_03_04_03 // 0.3.4.3
CodeYAMLAnchorRefused identifies an anchor (&name): outside the subset.
const CodeYAMLComplexKeyRefused errs.Code = 0x00_03_04_08 // 0.3.4.8
CodeYAMLComplexKeyRefused identifies a complex mapping key (the ? indicator, or a collection used as a key): outside the subset.
const CodeYAMLDepthExceeded errs.Code = 0x00_03_04_0D // 0.3.4.13
CodeYAMLDepthExceeded identifies input refused for a depth bound: collections nested past maxDepth, or UnmarshalYAML re-entered past it. Its reason is the family's DEPTH_EXCEEDED (#894).
const CodeYAMLDirectiveRefused errs.Code = 0x00_03_04_09 // 0.3.4.9
CodeYAMLDirectiveRefused identifies a directive (%YAML, %TAG): outside the subset.
const CodeYAMLDuplicateKey errs.Code = 0x00_03_04_0A // 0.3.4.10
CodeYAMLDuplicateKey identifies a mapping that holds the same key twice.
const CodeYAMLLeadingZeroRefused errs.Code = 0x00_03_04_0B // 0.3.4.11
CodeYAMLLeadingZeroRefused identifies an integer written with a leading zero read into a target whose value depends on it: YAML 1.1 reads 0644 as octal 420, YAML 1.2 as decimal 644.
const CodeYAMLMarshalFailed errs.Code = 0x00_03_04_01 // 0.3.4.1
CodeYAMLMarshalFailed identifies a value the encoder cannot write as YAML: an unsupported Go kind, a string that is not UTF-8, a key that is not a scalar, nesting past the bound, a MarshalYAML hook that failed, or a stream whose writer failed.
const CodeYAMLMergeKeyRefused errs.Code = 0x00_03_04_06 // 0.3.4.6
CodeYAMLMergeKeyRefused identifies a merge key (<<): outside the subset.
const CodeYAMLMultiDocRefused errs.Code = 0x00_03_04_07 // 0.3.4.7
CodeYAMLMultiDocRefused identifies a second document where one was expected.
const CodeYAMLSizeExceeded errs.Code = 0x00_03_04_0C // 0.3.4.12
CodeYAMLSizeExceeded identifies input refused for a size bound: a document past maxYAMLBytes, more than maxNodes nodes, or an implicit key past maxKeyRunes. Its reason is the family's SIZE_EXCEEDED (#894).
const CodeYAMLTagRefused errs.Code = 0x00_03_04_05 // 0.3.4.5
CodeYAMLTagRefused identifies an explicit tag (!local, !!str, !<uri>): outside the subset.
const CodeYAMLUnmarshalFailed errs.Code = 0x00_03_04_02 // 0.3.4.2
CodeYAMLUnmarshalFailed identifies a document the decoder cannot read: a syntax error, input past a bound, or a value its Go target cannot hold. Every refusal below carries it in its trail, so errs.HasCode answers for all of them.
Variables ¶
var ( // MarshalFailed marks a value the encoder cannot write as YAML. MarshalFailed = errs.Static(CodeYAMLMarshalFailed, "MARSHAL_FAILED", "YAML encoding failed", "service/data/codec/yaml: the value cannot be written in the supported YAML subset", 0, 0) // UnmarshalFailed marks a document the decoder cannot read into its target. UnmarshalFailed = errs.Static(CodeYAMLUnmarshalFailed, "UNMARSHAL_FAILED", "YAML decoding failed", "service/data/codec/yaml: not YAML of the supported subset, past a bound, or a value its target cannot hold", 0, 0) // AnchorRefused marks an anchor, refused by name. AnchorRefused = errs.Static(CodeYAMLAnchorRefused, "ANCHOR_REFUSED", "YAML anchors (&) are outside the supported subset", "service/data/codec/yaml: an anchor names a node for an alias to repeat; the subset has neither", 0, 0) // AliasRefused marks an alias, refused by name. AliasRefused = errs.Static(CodeYAMLAliasRefused, "ALIAS_REFUSED", "YAML aliases (*) are outside the supported subset", "service/data/codec/yaml: an alias repeats an anchored node; refused, so no document expands past its size", 0, 0) // TagRefused marks an explicit tag, refused by name. TagRefused = errs.Static(CodeYAMLTagRefused, "TAG_REFUSED", "YAML tags (! and !!) are outside the supported subset", "service/data/codec/yaml: a tag overrides the core schema; the subset resolves every scalar by the core schema alone", 0, 0) // MergeKeyRefused marks a merge key, refused by name. MergeKeyRefused = errs.Static(CodeYAMLMergeKeyRefused, "MERGE_KEY_REFUSED", "YAML merge keys (<<) are outside the supported subset", "service/data/codec/yaml: a merge key is a YAML 1.1 type that copies another mapping; quote it to mean the text <<", 0, 0) // MultipleDocumentsRefused marks a second document in a single-document read. MultipleDocumentsRefused = errs.Static(CodeYAMLMultiDocRefused, "MULTIPLE_DOCUMENTS_REFUSED", "YAML input holds more than one document", "service/data/codec/yaml: Unmarshal reads exactly one document; a stream of documents is read with NewDecoder", 0, 0) // ComplexKeyRefused marks a complex mapping key, refused by name. ComplexKeyRefused = errs.Static(CodeYAMLComplexKeyRefused, "COMPLEX_KEY_REFUSED", "YAML complex keys (?) are outside the supported subset", "service/data/codec/yaml: a mapping key must be a scalar on one line; ? and collection keys are refused", 0, 0) // DirectiveRefused marks a directive, refused by name. DirectiveRefused = errs.Static(CodeYAMLDirectiveRefused, "DIRECTIVE_REFUSED", "YAML directives (%YAML, %TAG) are outside the supported subset", "service/data/codec/yaml: the subset is YAML 1.2.2 with no tag handle, so a directive has nothing to declare", 0, 0) // DuplicateKey marks a mapping that holds the same key twice. DuplicateKey = errs.Static(CodeYAMLDuplicateKey, "DUPLICATE_KEY", "YAML mapping holds the same key twice", "service/data/codec/yaml: two keys of one mapping read the same; neither is chosen over the other", 0, 0) // LeadingZeroRefused marks an integer whose leading zero changes its value // between YAML versions. LeadingZeroRefused = errs.Static(CodeYAMLLeadingZeroRefused, "LEADING_ZERO_REFUSED", "YAML integer with a leading zero is octal in YAML 1.1 and decimal in 1.2", "service/data/codec/yaml: write 0o644 for octal, 644 for decimal, or quote the text", 0, 0) // SizeExceeded is the refusal of input past a size bound: a document past maxYAMLBytes, more than maxNodes nodes, or an implicit key past maxKeyRunes. SizeExceeded = errs.Static(CodeYAMLSizeExceeded, "SIZE_EXCEEDED", "YAML input exceeds a size limit", "service/data/codec/yaml: the input exceeds a size bound", 0, 0) // DepthExceeded is the refusal of input past a depth bound: collections nested past maxDepth, or UnmarshalYAML re-entered past it. DepthExceeded = errs.Static(CodeYAMLDepthExceeded, "DEPTH_EXCEEDED", "YAML input nests too deeply", "service/data/codec/yaml: the input exceeds a depth bound", 0, 0) )
Functions ¶
This section is empty.
Types ¶
This section is empty.