Documentation
¶
Overview ¶
Package errors provides structured error types with gRPC-compatible codes for gofly services. It supports error wrapping, HTTP status code mapping, and sentinel error matching.
Index ¶
- func GRPCError(err error) error
- func GRPCStatus(code Code) codes.Code
- func GRPCStatusFromCode(code Code) codes.Code
- func HTTPStatus(code Code) int
- func HTTPStatusFromCode(code Code) int
- func MessageOf(err error) string
- func Retryable(err error) bool
- func TextOf(err error) string
- type Code
- type Error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GRPCStatus ¶
func GRPCStatusFromCode ¶
func HTTPStatus ¶
func HTTPStatusFromCode ¶
Types ¶
type Code ¶
type Code string
Code is a gRPC-compatible error code.
const ( CodeOK Code = "ok" CodeCanceled Code = "canceled" CodeUnknown Code = "unknown" CodeInvalidArgument Code = "invalid_argument" CodeDeadlineExceeded Code = "deadline_exceeded" CodeNotFound Code = "not_found" CodeAlreadyExists Code = "already_exists" CodePermissionDenied Code = "permission_denied" CodeResourceExhausted Code = "resource_exhausted" CodeFailedPrecondition Code = "failed_precondition" CodeAborted Code = "aborted" CodeOutOfRange Code = "out_of_range" CodeUnimplemented Code = "unimplemented" CodeInternal Code = "internal" CodeDataLoss Code = "data_loss" CodeUnauthenticated Code = "unauthenticated" )
func CodeFromGRPCStatus ¶
type Error ¶
Error is a structured error with a code, message, and optional wrapped cause.
func (*Error) GRPCStatus ¶
func (*Error) HTTPStatus ¶
Click to show internal directories.
Click to hide internal directories.