multipart

package
v0.19.5 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 multipart declares the error codes and the sentinels of the multipart/form-data codec, internal/service/data/codec/multipart — range 0.3.41.* (ADR 0005 service/data/codec/multipart 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 multipart — 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

View Source
const CodeMultipartBoundaryInvalid errs.Code = 0x00_03_29_04 // 0.3.41.4

CodeMultipartBoundaryInvalid identifies a boundary the codec cannot use: caller-supplied but outside the RFC 2046 charset / length, or absent from a body whose first delimiter line could not be recovered.

View Source
const CodeMultipartLimitExceeded errs.Code = 0x00_03_29_05 // 0.3.41.5

CodeMultipartLimitExceeded identifies a payload that crossed one of the configured bounds — per-part bytes, part count, or aggregate bytes.

View Source
const CodeMultipartLimitsInvalid errs.Code = 0x00_03_29_06 // 0.3.41.6

CodeMultipartLimitsInvalid identifies a Limits value the codec refuses to interpret: a negative bound is neither a bound nor a documented default, and guessing which one the caller meant is exactly what ADR 0031 forbids.

View Source
const CodeMultipartMarshalFailed errs.Code = 0x00_03_29_01 // 0.3.41.1

CodeMultipartMarshalFailed identifies a failure while writing a multipart/form-data body — a part header, a part body, or the JSON intermediate produced for the JSON-mediated single-part shape.

View Source
const CodeMultipartUnmarshalFailed errs.Code = 0x00_03_29_02 // 0.3.41.2

CodeMultipartUnmarshalFailed identifies a failure while parsing a multipart/form-data body: a malformed part header, a part with no form-data name, a missing closing delimiter, or a JSON-mediated part whose payload is not valid JSON.

View Source
const CodeMultipartValueInvalid errs.Code = 0x00_03_29_03 // 0.3.41.3

CodeMultipartValueInvalid identifies a Marshal / Unmarshal / Encode call whose argument shape the codec cannot honour — an Unmarshal target that is not a non-nil pointer, a Part carrying no field name, or a Part whose Name, FileName or ContentType carries a CR, LF or NUL (field "field" names which).

Variables

View Source
var (
	// MarshalFailed wraps a failure raised while writing a part.
	MarshalFailed = errs.Define(CodeMultipartMarshalFailed, "MARSHAL_FAILED",
		"multipart encoding failed",
		"service/data/codec/multipart: mime/multipart returned an error while writing a part")

	// UnmarshalFailed wraps a failure raised while parsing a body.
	UnmarshalFailed = errs.Define(CodeMultipartUnmarshalFailed, "UNMARSHAL_FAILED",
		"multipart decoding failed",
		"service/data/codec/multipart: mime/multipart returned an error while reading a part")

	// ValueInvalid fires when the caller's argument shape cannot be honoured.
	ValueInvalid = errs.Define(CodeMultipartValueInvalid, "VALUE_INVALID",
		"multipart codec rejected the value shape",
		"service/data/codec/multipart: Marshal/Unmarshal called with an unusable argument")

	// BoundaryInvalid fires when no usable RFC 2046 boundary is available.
	BoundaryInvalid = errs.Define(CodeMultipartBoundaryInvalid, "BOUNDARY_INVALID",
		"multipart boundary is missing or invalid",
		"service/data/codec/multipart: boundary absent from the body or outside the RFC 2046 charset")

	// LimitExceeded fires when a payload crosses one of the configured bounds.
	LimitExceeded = errs.Define(CodeMultipartLimitExceeded, "LIMIT_EXCEEDED",
		"multipart payload exceeds a configured limit",
		"service/data/codec/multipart: part size, part count or aggregate size crossed its bound")

	// LimitsInvalid fires when a Limits value carries a negative bound.
	LimitsInvalid = errs.Define(CodeMultipartLimitsInvalid, "LIMITS_INVALID",
		"multipart limits are not usable",
		"service/data/codec/multipart: a negative bound is neither a limit nor a request for the default")
)

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