Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ( // NotFound is returned when a resource is not found NotFound = errors.NewWithDepth(depth, "not found") // InternalError is returned when internal logic got error InternalError = errors.NewWithDepth(depth, "internal error") // SomethingWentWrong is returned when got some bug or unexpected case // // inherited error from InternalError, // so errors.Is(err, InternalError) == true SomethingWentWrong = errors.WrapWithDepth(depth, InternalError, "something went wrong") // Skippable is returned when got an error but it can be skipped or ignored and continue Skippable = errors.NewWithDepth(depth, "skippable") // Retryable is returned when got an error but it can be retried Retryable = errors.NewWithDepth(depth, "retryable") // Unsupported is returned when a feature or result is not supported Unsupported = errors.NewWithDepth(depth, "unsupported") // NotSupported is returned when a feature or result is not supported // alias of Unsupported NotSupported = Unsupported Unauthorized = errors.NewWithDepth(depth, "unauthorized") // Timeout is returned when a connection to a resource timed out Timeout = errors.NewWithDepth(depth, "timeout") // BadRequest is returned when a request is invalid BadRequest = errors.NewWithDepth(depth, "bad request") // InvalidArgument is returned when an argument is invalid // // inherited error from BadRequest, // so errors.Is(err, BadRequest) == true InvalidArgument = errors.WrapWithDepth(depth, BadRequest, "invalid argument") // ArgumentRequired is returned when an argument is required // // inherited error from BadRequest, // so errors.Is(err, BadRequest) == true ArgumentRequired = errors.WrapWithDepth(depth, BadRequest, "argument required") // Duplicate is returned when a resource already exists Duplicate = errors.NewWithDepth(depth, "duplicate") // Unimplemented is returned when a feature or method is not implemented // // inherited error from Unsupported, // so errors.Is(err, Unsupported) == true Unimplemented = errors.WrapWithDepth(depth, Unsupported, "unimplemented") Unavailable = errors.NewWithDepth(depth, "unavailable") // RateLimitExceeded is returned when a rate limit is exceeded RateLimitExceeded = errors.NewWithDepth(depth, "rate limit exceeded") // Overflow is returned when an overflow error occurs // // inherited error from InternalError, // so errors.Is(err, InternalError) == true Overflow = errors.WrapWithDepth(depth, InternalError, "overflow") // InvalidState is returned when a state is invalid InvalidState = errors.NewWithDepth(depth, "invalid state") // Closed is returned when a resource is closed Closed = errors.NewWithDepth(depth, "closed") )
Common Application Errors
Functions ¶
func NewPublicError ¶
func NewPublicErrorWithCode ¶
func WithPublicMessage ¶
Types ¶
type PublicError ¶
type PublicError struct {
// contains filtered or unexported fields
}
PublicError is an error that, when caught by an error handler, should return a user-friendly error response to the user. Responses vary between each protocol (http, grpc, etc.) and between each error handler implementation.
func (PublicError) Code ¶
func (p PublicError) Code() string
func (PublicError) Error ¶
func (p PublicError) Error() string
func (PublicError) Message ¶
func (p PublicError) Message() string
func (PublicError) Unwrap ¶
func (p PublicError) Unwrap() error
Click to show internal directories.
Click to hide internal directories.