Documentation ¶
Index ¶
- Constants
- func AltErrorf(err error, f string, args ...interface{}) error
- func Annotate(err error, msg string) error
- func Annotatef(err error, f string, args ...interface{}) error
- func FromOS(err error) error
- func IsInternal(err error) bool
- func IsInvalidArg(err error) bool
- func IsNotFound(err error) bool
- func IsTimeOut(err error) bool
- func IsUnauthorized(err error) bool
- func Of(err error) string
- type Error
- func Add(code string, err error) *Error
- func Errorf(code string, f string, args ...interface{}) *Error
- func Internalf(f string, args ...interface{}) *Error
- func InvalidArgf(f string, args ...interface{}) *Error
- func NotFoundf(f string, args ...interface{}) *Error
- func TimeOutf(f string, args ...interface{}) *Error
- func Unauthorizedf(f string, args ...interface{}) *Error
Constants ¶
View Source
const ( NotFound = "not-found" InvalidArg = "invalid-arg" Internal = "internal" TimeOut = "time-out" )
Common general error codes
Variables ¶
This section is empty.
Functions ¶
func AltErrorf ¶
AltErrorf replaces the message of err to be the formatted message, but keeps the error code.
func IsInvalidArg ¶
IsInvalidArg checks if it is an invalid argument error.
func IsUnauthorized ¶
IsUnauthorized checks if it is an unauthorized error.
Types ¶
type Error ¶
type Error struct { Code string // code is the type of the error. Err error // error is the error message, human friendly. Message string // alternative message. }
Error is a generic error with a string error code.
func InvalidArgf ¶
InvalidArgf creates a new invalid arugment error.
func Unauthorizedf ¶
Unauthorizedf returns an error caused by an unauthrozied request.
Click to show internal directories.
Click to hide internal directories.