Documentation
¶
Overview ¶
Package csv declares the error codes and the sentinels of the CSV codec, internal/service/data/codec/csv — range 0.3.8.* (ADR 0005 service/data/codec/csv 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 csv — 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 CodeCSVCellInvalid errs.Code = 0x00_03_08_05 // 0.3.8.5
CodeCSVCellInvalid identifies a cell that does not convert to the type of the field its column maps to: a number or a bool that does not parse, a text a type's UnmarshalText refuses.
const CodeCSVHeaderMismatch errs.Code = 0x00_03_08_04 // 0.3.8.4
CodeCSVHeaderMismatch identifies a header that does not fit the struct a table is read into: a column the struct requires is missing, or one it maps appears twice.
const CodeCSVMarshalFailed errs.Code = 0x00_03_08_01 // 0.3.8.1
CodeCSVMarshalFailed identifies a failure inside encoding/csv.Writer.
const CodeCSVOptionsInvalid errs.Code = 0x00_03_08_06 // 0.3.8.6
CodeCSVOptionsInvalid identifies Options NewWithOptions refuses: a delimiter encoding/csv cannot use.
const CodeCSVUnmarshalFailed errs.Code = 0x00_03_08_02 // 0.3.8.2
CodeCSVUnmarshalFailed identifies a failure inside encoding/csv.Reader.
const CodeCSVValueInvalid errs.Code = 0x00_03_08_03 // 0.3.8.3
CodeCSVValueInvalid identifies a Marshal / Unmarshal call whose target is not a *[][]string (CSV only serialises a records matrix).
Variables ¶
var ( // MarshalFailed wraps a failure from encoding/csv.Writer.Write(All). MarshalFailed = errs.Static(CodeCSVMarshalFailed, "MARSHAL_FAILED", "CSV encoding failed", "service/data/codec/csv: encoding/csv.Writer.WriteAll returned an error", 0, 0) // UnmarshalFailed wraps a failure from encoding/csv.Reader.ReadAll. UnmarshalFailed = errs.Static(CodeCSVUnmarshalFailed, "UNMARSHAL_FAILED", "CSV decoding failed", "service/data/codec/csv: encoding/csv.Reader.ReadAll returned an error", 0, 0) // ValueInvalid fires when the caller does not pass a *[][]string. ValueInvalid = errs.Static(CodeCSVValueInvalid, "VALUE_INVALID", "CSV codec requires a [][]string value", "service/data/codec/csv: Marshal/Unmarshal called with non-[][]string argument", 0, 0) // HeaderMismatch fires when a header lacks a column the struct requires, or // names one it maps twice. Its fields name the column as the struct names // it, never a cell of the input. HeaderMismatch = errs.Static(CodeCSVHeaderMismatch, "HEADER_MISMATCH", "CSV header does not match the expected columns", "service/data/codec/csv: the header does not fit the struct; the fields name the problem and the column", 400, 0) // CellInvalid fires when a cell does not convert to its field's type. Its // fields name the record and the column, never the cell. CellInvalid = errs.Static(CodeCSVCellInvalid, "CELL_INVALID", "CSV cell does not convert to its column's type", "service/data/codec/csv: a cell does not convert to its field's type; the fields name the record and the column", 400, 0) // OptionsInvalid fires when NewWithOptions is given a delimiter encoding/csv cannot use. OptionsInvalid = errs.Static(CodeCSVOptionsInvalid, "OPTIONS_INVALID", "CSV options are invalid", "service/data/codec/csv: NewWithOptions was given an invalid delimiter", 0, 0) )
Functions ¶
This section is empty.
Types ¶
This section is empty.