Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GetGRPCErrorContext ¶
GetGRPCErrorContext extracts the context from a GRPCError if it exists in a joined error chain.
func IsAnyError ¶
Types ¶
type ErrorMapper ¶ added in v0.4.0
type ErrorMapper[T Error[T]] struct { Errors []ExposedErrors[T] // Error to mapTo PriorityErrors []ExposedErrors[T] }
func NewMapper ¶ added in v0.4.0
func NewMapper[T Error[T]](errors []ExposedErrors[T], priorityErrors []ExposedErrors[T]) ErrorMapper[T]
func (*ErrorMapper[T]) Transform ¶ added in v0.4.0
func (m *ErrorMapper[T]) Transform(ctx context.Context, internalErr error) T
Transform has the following rules to find the best match: 1. If error is in priority return the priority one 2. Return ExposedError containing the highest number of errors in err chain 3. If no error found return default
type ExposedErrors ¶ added in v0.4.0
type GRPCError ¶
type GRPCError struct {
Code GRPCErrorCode
BaseMessage string
Reason string
Metadata map[string]string
}
GRPCError represents a structured error for gRPC responses. The error can be matched using errors.Is and errors.As.
func (GRPCError) FromStatusError ¶
type GRPCErrorCode ¶
type GRPCErrorCode string
type JoinedError ¶
type JoinedError interface {
Unwrap() []error
}
Click to show internal directories.
Click to hide internal directories.