Documentation
¶
Index ¶
- func As(err error, target any) bool
- func Details(err error) map[string]any
- func Is(err error, target error) bool
- func IsAborted(err error) bool
- func IsConflict(err error) bool
- func IsInternal(err error) bool
- func IsInvalidArgument(err error) bool
- func IsNotFound(err error) bool
- func IsPreconditionFailed(err error) bool
- func Message(err error) string
- func New(text string) error
- type Error
- func Aborted(format string, args ...interface{}) *Error
- func AsError(err error) (e *Error)
- func Conflict(format string, args ...interface{}) *Error
- func Failed(format string, args ...interface{}) *Error
- func Format(code Status, format string, args ...interface{}) *Error
- func Internal(err error, format string, args ...interface{}) *Error
- func InvalidArgument(format string, args ...interface{}) *Error
- func NotFound(format string, args ...interface{}) *Error
- func PreconditionFailed(format string, args ...interface{}) *Error
- type Status
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func IsInvalidArgument ¶
IsInvalidArgument checks if err is invalid argument error.
func IsPreconditionFailed ¶
IsPreconditionFailed checks if err is precondition failed error.
Types ¶
type Error ¶
type Error struct { // Machine-readable status code. Status Status // Human-readable error message. Message string // Source error Err error // Details Details map[string]any }
func Format ¶
Format is a helper function to return an Error with a given status and formatted message.
func InvalidArgument ¶
InvalidArgument is a helper function to return an invalid argument Error.
func PreconditionFailed ¶
PreconditionFailed is a helper function to return an precondition failed error.
type Status ¶
type Status string
const ( StatusConflict Status = "conflict" StatusInternal Status = "internal" StatusInvalidArgument Status = "invalid" StatusNotFound Status = "not_found" StatusNotImplemented Status = "not_implemented" StatusFailed Status = "failed" StatusPreconditionFailed Status = "precondition_failed" StatusAborted Status = "aborted" )
Click to show internal directories.
Click to hide internal directories.