Documentation
¶
Index ¶
- Variables
- func As(err error, target any) bool
- func Factory() *factory
- func Is(err error, targets ...error) bool
- func IsNot(err error, targets ...error) bool
- func Join(errs ...error) error
- func NotAs(err error, target any) bool
- func Unwrap(err error) error
- type Code
- type Error
- func (e *Error) As(err error) bool
- func (e *Error) Code() Code
- func (e *Error) Error() string
- func (e *Error) Is(targets ...error) bool
- func (e *Error) IsEmpty() bool
- func (e *Error) Location() *location
- func (e *Error) Message() string
- func (e *Error) Meta() []detail
- func (e *Error) StackTrace() []runtime.Frame
- func (e *Error) String() string
- func (e *Error) Timestamp() *time.Time
- func (e *Error) Unwrap() []error
- func (e *Error) With(key string, value any) *Error
- func (e *Error) WithLocation() *Error
- func (e *Error) WithTime() *Error
- func (e *Error) WithTrace(skip int) *Error
- func (e *Error) Wrap(err error) *Error
Constants ¶
This section is empty.
Variables ¶
View Source
var ( ErrCanceled = E(Canceled) ErrUnknown = E(Unknown) ErrInvalidArgument = E(InvalidArgument) ErrDeadlineExceeded = E(DeadlineExceeded) ErrNotFound = E(NotFound) ErrAlreadyExists = E(AlreadyExists) ErrPermissionDenied = E(PermissionDenied) ErrResourceExhausted = E(ResourceExhausted) ErrFailedPrecondition = E(FailedPrecondition) ErrAborted = E(Aborted) ErrOutOfRange = E(OutOfRange) ErrUnimplemented = E(Unimplemented) ErrInternal = E(Internal) ErrDataLoss = E(DataLoss) ErrUnauthenticated = E(Unauthenticated) )
View Source
var DefaultFactory = Factory().StackTrace(true)
Functions ¶
Types ¶
type Code ¶ added in v0.2.0
type Code int
const ( // Canceled indicates that the operation was Canceled, typically by the caller. Canceled Code = 1 // Unknown indicates that the operation failed for an Unknown reason. Unknown Code = 2 // InvalidArgument indicates that client supplied an invalid argument. InvalidArgument Code = 3 // DeadlineExceeded indicates that deadline expired before the operation could complete. DeadlineExceeded Code = 4 // NotFound indicates that some requested entity (for example, a file or directory) was not found. NotFound Code = 5 // AlreadyExists indicates that client attempted to create an entity (for example, a file or directory) that already exists. AlreadyExists Code = 6 // PermissionDenied indicates that the caller doesn't have permission to execute the specified operation. PermissionDenied Code = 7 // ResourceExhausted indicates that some resource has been exhausted. // For example, a per-user quota may be exhausted or the entire file system may be full. ResourceExhausted Code = 8 // FailedPrecondition indicates that the system is not in a state required for the operation's execution. FailedPrecondition Code = 9 // Aborted indicates that operation was Aborted by the system, // usually because of a concurrency issue such as a sequencer check failure or transaction abort. Aborted Code = 10 // OutOfRange indicates that the operation was attempted past the valid range (for example, seeking past end-of-file). OutOfRange Code = 11 // Unimplemented indicates that the operation isn't implemented, supported, or enabled in this service. Unimplemented Code = 12 // Internal indicates that some invariants expected by the underlying system have been broken. // This code is reserved for serious errors. Internal Code = 13 // This is usually temporary, so clients can back off and retry idempotent operations. Unavailable Code = 14 // DataLoss indicates that the operation has resulted in unrecoverable data loss or corruption. DataLoss Code = 15 // Unauthenticated indicates that the request does not have valid authentication credentials for the operation. Unauthenticated Code = 16 )
func CodeOf ¶
CodeOf returns the error's status code if it is or wraps an *Error and [unknown] otherwise.
func (*Code) MarshalText ¶ added in v0.2.0
MarshalText implements encoding.TextMarshaler.
func (*Code) UnmarshalText ¶ added in v0.2.0
UnmarshalText implements encoding.TextUnmarshaler.
type Error ¶
type Error struct {
// contains filtered or unexported fields
}
func (*Error) StackTrace ¶ added in v0.2.0
func (*Error) WithLocation ¶
Click to show internal directories.
Click to hide internal directories.