form

package
v0.19.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 5, 2026 License: MIT Imports: 1 Imported by: 0

Documentation

Overview

Package form declares the error codes and the sentinels of the application/x-www-form-urlencoded codec, internal/service/data/codec/form — range 0.3.40.* (ADR 0005 service/data/codec/form 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 form — 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.

There is deliberately no MarshalFailed sentinel: once the codec has accepted the argument shape, percent-escaping a map of strings is a total function — no byte sequence can make it fail. Defining an unreachable sentinel would put a code in the registry that no test can ever provoke.

Index

Constants

View Source
const CodeFormMultiValue errs.Code = 0x00_03_28_03 // 0.3.40.3

CodeFormMultiValue identifies a decode into a single-valued target (map[string]string) of a body that repeats a key — the one case where the requested Go shape cannot hold what the wire carries.

View Source
const CodeFormUnmarshalFailed errs.Code = 0x00_03_28_02 // 0.3.40.2

CodeFormUnmarshalFailed identifies a decode refusal: a malformed percent-escape, the ';' separator net/url rejects since Go 1.17, or an input that trips one of the package's decode bounds.

View Source
const CodeFormValueInvalid errs.Code = 0x00_03_28_01 // 0.3.40.1

CodeFormValueInvalid identifies a Marshal / Append / Unmarshal call whose argument is not one of the shapes the urlencoded wire format models (url.Values, map[string][]string, map[string]string, or a pointer to one).

Variables

View Source
var (
	// ValueInvalid fires when the caller does not pass a urlencoded-shaped
	// value (url.Values / map[string][]string / map[string]string, or a
	// non-nil pointer to one).
	ValueInvalid = errs.Define(CodeFormValueInvalid, "VALUE_INVALID",
		"form codec requires a url.Values-shaped value",
		"service/data/codec/form: Marshal/Append/Unmarshal called with an unsupported argument shape")

	// UnmarshalFailed wraps a refusal from net/url.ParseQuery or a decode
	// bound (maxFormBytes / maxFormPairs).
	UnmarshalFailed = errs.Define(CodeFormUnmarshalFailed, "UNMARSHAL_FAILED",
		"form decoding failed",
		"service/data/codec/form: net/url.ParseQuery returned an error or a decode bound was exceeded")

	// MultiValue fires when a repeated key is decoded into a map[string]string
	// target, which can hold exactly one value per key.
	MultiValue = errs.Define(CodeFormMultiValue, "MULTI_VALUE",
		"form key carries multiple values",
		"service/data/codec/form: map[string]string target cannot hold a repeated key")
)

Functions

This section is empty.

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL