Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ( BadRequest = newKind(400) // RFC 7231, 6.5.1 PaymentRequired = newKind(402) // RFC 7231, 6.5.2 Forbidden = newKind(403) // RFC 7231, 6.5.3 NotFound = newKind(404) // RFC 7231, 6.5.4 MethodNotAllowed = newKind(405) // RFC 7231, 6.5.5 NotAcceptable = newKind(406) // RFC 7231, 6.5.6 ProxyAuthRequired = newKind(407) // RFC 7235, 3.2 RequestTimeout = newKind(408) // RFC 7231, 6.5.7 Conflict = newKind(409) // RFC 7231, 6.5.8 Gone = newKind(410) // RFC 7231, 6.5.9 LengthRequired = newKind(411) // RFC 7231, 6.5.10 PreconditionFailed = newKind(412) // RFC 7232, 4.2 RequestEntityTooLarge = newKind(413) // RFC 7231, 6.5.11 RequestURITooLong = newKind(414) // RFC 7231, 6.5.12 UnsupportedMediaType = newKind(415) // RFC 7231, 6.5.13 RequestedRangeNotSatisfiable = newKind(416) // RFC 7233, 4.4 ExpectationFailed = newKind(417) // RFC 7231, 6.5.14 Teapot = newKind(418) // RFC 7168, 2.3.3 UnprocessableEntity = newKind(422) // RFC 4918, 11.2 Locked = newKind(423) // RFC 4918, 11.3 FailedDependency = newKind(424) // RFC 4918, 11.4 UpgradeRequired = newKind(426) // RFC 7231, 6.5.15 PreconditionRequired = newKind(428) // RFC 6585, 3 TooManyRequests = newKind(429) // RFC 6585, 4 RequestHeaderFieldsTooLarge = newKind(431) // RFC 6585, 5 InternalServerError = newKind(500) // RFC 7231, 6.6.1 NotImplemented = newKind(501) // RFC 7231, 6.6.2 BadGateway = newKind(502) // RFC 7231, 6.6.3 GatewayTimeout = newKind(504) // RFC 7231, 6.6.5 HTTPVersionNotSupported = newKind(505) // RFC 7231, 6.6.6 VariantAlsoNegotiates = newKind(506) // RFC 2295, 8.1 InsufficientStorage = newKind(507) // RFC 4918, 11.5 LoopDetected = newKind(508) // RFC 5842, 7.2 NotExtended = newKind(510) // RFC 2774, 7 NetworkAuthenticationRequired = newKind(511) // RFC 6585, 6 )
These factory builders is used to build error factory.
Functions ¶
This section is empty.
Types ¶
type Builder ¶
type Builder interface { // Build builds a factory to generate errors with predefined format. Build(reason Reason, format string) Factory // Error immediately creates an error without reason. Error(format string, v ...interface{}) error }
Builder can build error factories and errros.
type Factory ¶
type Factory interface { // Error generates an error from v. Error(v ...interface{}) error // Derived checks if an error was derived from current factory. Derived(e error) bool }
Factory can create error from a fixed format.
type Reason ¶
type Reason string
Reason is an enumeration of possible failure causes. Each Reason must map to a format which is a string containing ${formatArgu1}.
Following format is recommended:
MuduleName[:SubmoduleName]:ShortErrorDescription
Examples:
Reason "Nirvana:KindNotFound" may map to format "${kindName} was not found". Reason "Nirvana:SomeoneIsSleeping" may map to format "${name} is sleeping now"
Click to show internal directories.
Click to hide internal directories.