Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Friendly ¶
Friendly returns a user-friendly, action-oriented message string. It uses request context (method/URL) when available, and produces clearer phrasing than the raw error text.
func Map ¶
Map converts an arbitrary error into an *Error with a best-effort code. It keeps the original error as the cause.
func MapRequestError ¶
MapRequestError annotates the mapped error with request context.
Types ¶
type Code ¶
type Code string
Code classifies high-level error categories for user-facing messages.
const ( CodeCanceled Code = "canceled" CodeTimeout Code = "timeout" CodeDNSError Code = "dns_error" CodeInvalidURL Code = "invalid_url" CodeUnsupportedScheme Code = "unsupported_scheme" CodeConnectionRefused Code = "connection_refused" CodeConnectionReset Code = "connection_reset" CodeNetworkUnreachable Code = "network_unreachable" CodeTLSUnknownAuthority Code = "tls_unknown_authority" CodeTLSHostnameMismatch Code = "tls_hostname_mismatch" CodeTLSHandshake Code = "tls_handshake" CodeIO Code = "io_error" CodeUnexpected Code = "unexpected" CodeExpressionSyntax Code = "expression_syntax" CodeExpressionRuntime Code = "expression_runtime" )
type Error ¶
type Error struct {
Code Code
Message string
Method string
URL string
Temporary bool
Retryable bool
// contains filtered or unexported fields
}
Error is a small, idiomatic wrapper that carries a code and context while preserving the original cause via Unwrap.
Click to show internal directories.
Click to hide internal directories.