Documentation
¶
Overview ¶
Package cbor declares the error codes and the sentinels of the CBOR codec, internal/service/data/codec/cbor — range 0.3.6.* (ADR 0005 service/data/codec/cbor 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 cbor — 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 CodeCBORDepthExceeded errs.Code = 0x00_03_06_07 // 0.3.6.7
CodeCBORDepthExceeded identifies input refused for a depth bound: arrays, maps and tags nested past 32 levels. Its reason is the family's DEPTH_EXCEEDED (#894).
const CodeCBORDuplicateKey errs.Code = 0x00_03_06_03 // 0.3.6.3
CodeCBORDuplicateKey identifies a document NewStrict's instance refused because one of its maps repeats a key.
const CodeCBORMarshalFailed errs.Code = 0x00_03_06_01 // 0.3.6.1
CodeCBORMarshalFailed identifies an encoding failure: a value of a type CBOR cannot carry, a string that is not UTF-8, a nesting deeper than the decoder accepts, a failing writer, MarshalBinary or MarshalCBOR.
const CodeCBORNotDeterministic errs.Code = 0x00_03_06_05 // 0.3.6.5
CodeCBORNotDeterministic identifies a document NewDeterministic's instance refused because it is not in the core deterministic encoding of RFC 8949 §4.2.1: a head or a float longer than it needs, an indefinite length, a NaN other than 0xf97e00, or map keys out of the bytewise order of their encodings.
const CodeCBORSizeExceeded errs.Code = 0x00_03_06_06 // 0.3.6.6
CodeCBORSizeExceeded identifies input refused for a size bound: an array, map or chunked string past its 1 048 576-entry bound, or a data item longer than NewBoundedDecoder's byte ceiling (#891). Its reason is the family's SIZE_EXCEEDED (#894).
const CodeCBORUnknownMember errs.Code = 0x00_03_06_04 // 0.3.6.4
CodeCBORUnknownMember identifies a document NewStrict's instance refused because it carries a member no field of the target struct claims.
const CodeCBORUnmarshalFailed errs.Code = 0x00_03_06_02 // 0.3.6.2
CodeCBORUnmarshalFailed identifies a decoding failure: input that is not one well-formed, valid data item, a bound exceeded, or an item the target cannot hold.
Variables ¶
var ( // MarshalFailed is the sentinel every encoding failure matches: a value // CBOR cannot carry, a string that is not UTF-8, a nesting deeper than // the decoder accepts, a failing writer, MarshalBinary or MarshalCBOR. MarshalFailed = errs.Static(CodeCBORMarshalFailed, "MARSHAL_FAILED", "CBOR encoding failed", "service/data/codec/cbor: a value could not be encoded as CBOR", 0, 0) // UnmarshalFailed is the sentinel every decoding failure matches: input // that is not one well-formed, valid data item, a bound exceeded, or an // item the target cannot hold. UnmarshalFailed = errs.Static(CodeCBORUnmarshalFailed, "UNMARSHAL_FAILED", "CBOR decoding failed", "service/data/codec/cbor: the input could not be decoded as CBOR", 0, 0) // DuplicateKey is the strict refusal of a map that repeats a key. DuplicateKey = errs.Static(CodeCBORDuplicateKey, "DUPLICATE_KEY", "CBOR document repeats a map key", "service/data/codec/cbor: NewStrict refused a map holding two equal keys", 0, 0) // UnknownMember is the strict refusal of a member no struct field claims. UnknownMember = errs.Static(CodeCBORUnknownMember, "UNKNOWN_MEMBER", "CBOR document carries an unknown member", "service/data/codec/cbor: NewStrict refused a member no field of the struct claims", 0, 0) // NotDeterministic is the refusal of a document NewDeterministic's // instance does not read: one not in RFC 8949 §4.2.1's core // deterministic encoding. NotDeterministic = errs.Static(CodeCBORNotDeterministic, "NOT_DETERMINISTIC", "CBOR document is not in deterministic encoding", "service/data/codec/cbor: NewDeterministic refused a document not in core deterministic encoding", 0, 0) // SizeExceeded is the refusal of input past a size bound: an array, map or // chunked string past its 1 048 576-entry bound, or an item past // NewBoundedDecoder's ceiling. SizeExceeded = errs.Static(CodeCBORSizeExceeded, "SIZE_EXCEEDED", "CBOR input exceeds a size limit", "service/data/codec/cbor: the input exceeds a size bound", 0, 0) // DepthExceeded is the refusal of input past a depth bound: arrays, maps and tags nested past 32 levels. DepthExceeded = errs.Static(CodeCBORDepthExceeded, "DEPTH_EXCEEDED", "CBOR input nests too deeply", "service/data/codec/cbor: the input exceeds a depth bound", 0, 0) )
Sentinels, matched with errors.Is or errs.HasCode / errs.HasReason.
Functions ¶
This section is empty.
Types ¶
This section is empty.