errors

package
v2.0.0-alpha6 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 5, 2021 License: MIT Imports: 9 Imported by: 919

Documentation

Index

Constants

View Source
const (
	// UnknownReason is unknown reason for error info.
	UnknownReason = ""
	// SupportPackageIsVersion1 this constant should not be referenced by any other code.
	SupportPackageIsVersion1 = true
)

Variables

View Source
var File_errors_proto protoreflect.FileDescriptor

Functions

func Aborted

func Aborted(reason, format string, a ...interface{}) error

Aborted The operation was aborted, typically due to a concurrency issue such as a sequencer check failure or transaction abort. HTTP Mapping: 409 Conflict

func AlreadyExists

func AlreadyExists(reason, format string, a ...interface{}) error

AlreadyExists The entity that a client attempted to create (e.g., file or directory) already exists. HTTP Mapping: 409 Conflict

func Cancelled

func Cancelled(reason, format string, a ...interface{}) error

Cancelled The operation was cancelled, typically by the caller. HTTP Mapping: 499 Client Closed Request

func Code

func Code(err error) int32

Code returns the status code.

func DataLoss

func DataLoss(reason, format string, a ...interface{}) error

DataLoss Unrecoverable data loss or corruption. HTTP Mapping: 500 Internal Server Error

func DeadlineExceeded

func DeadlineExceeded(reason, format string, a ...interface{}) error

DeadlineExceeded The deadline expired before the operation could complete. HTTP Mapping: 504 Gateway Timeout

func Error

func Error(code int32, reason, message string) error

Error returns a Status representing c and msg.

func Errorf

func Errorf(code int32, reason, format string, a ...interface{}) error

Errorf returns New(c, fmt.Sprintf(format, a...)).

func FailedPrecondition

func FailedPrecondition(reason, format string, a ...interface{}) error

FailedPrecondition The operation was rejected because the system is not in a state required for the operation's execution. HTTP Mapping: 400 Bad Request

func Internal

func Internal(reason, format string, a ...interface{}) error

Internal This means that some invariants expected by the underlying system have been broken. This error code is reserved for serious errors.

HTTP Mapping: 500 Internal Server Error

func InvalidArgument

func InvalidArgument(reason, format string, a ...interface{}) error

InvalidArgument The client specified an invalid argument. HTTP Mapping: 400 Bad Request

func IsAborted

func IsAborted(err error) bool

IsAborted determines if err is an error which indicates an aborted error. It supports wrapped errors.

func IsAlreadyExists

func IsAlreadyExists(err error) bool

IsAlreadyExists determines if err is an error which indicates a already exsits error. It supports wrapped errors.

func IsCancelled

func IsCancelled(err error) bool

IsCancelled determines if err is an error which indicates a cancelled error. It supports wrapped errors.

func IsDataLoss

func IsDataLoss(err error) bool

IsDataLoss determines if err is an error which indicates a data loss error. It supports wrapped errors.

func IsDeadlineExceeded

func IsDeadlineExceeded(err error) bool

IsDeadlineExceeded determines if err is an error which indicates a deadline exceeded error. It supports wrapped errors.

func IsFailedPrecondition

func IsFailedPrecondition(err error) bool

IsFailedPrecondition determines if err is an error which indicates a failed precondition error. It supports wrapped errors.

func IsInternal

func IsInternal(err error) bool

IsInternal determines if err is an error which indicates an internal server error. It supports wrapped errors.

func IsInvalidArgument

func IsInvalidArgument(err error) bool

IsInvalidArgument determines if err is an error which indicates an invalid argument error. It supports wrapped errors.

func IsNotFound

func IsNotFound(err error) bool

IsNotFound determines if err is an error which indicates a not found error. It supports wrapped errors.

func IsOutOfRange

func IsOutOfRange(err error) bool

IsOutOfRange determines if err is an error which indicates a out of range error. It supports wrapped errors.

func IsPermissionDenied

func IsPermissionDenied(err error) bool

IsPermissionDenied determines if err is an error which indicates a permission denied error. It supports wrapped errors.

func IsResourceExhausted

func IsResourceExhausted(err error) bool

IsResourceExhausted determines if err is an error which indicates a resource exhausted error. It supports wrapped errors.

func IsUnauthorized

func IsUnauthorized(err error) bool

IsUnauthorized determines if err is an error which indicates a unauthorized error. It supports wrapped errors.

func IsUnavailable

func IsUnavailable(err error) bool

IsUnavailable determines if err is an error which indicates a unavailable error. It supports wrapped errors.

func IsUnimplemented

func IsUnimplemented(err error) bool

IsUnimplemented determines if err is an error which indicates a unimplemented error. It supports wrapped errors.

func IsUnknown

func IsUnknown(err error) bool

IsUnknown determines if err is an error which indicates a unknown error. It supports wrapped errors.

func NotFound

func NotFound(reason, format string, a ...interface{}) error

NotFound Some requested entity (e.g., file or directory) was not found. HTTP Mapping: 404 Not Found

func OutOfRange

func OutOfRange(reason, format string, a ...interface{}) error

OutOfRange The operation was attempted past the valid range. E.g., seeking or reading past end-of-file. HTTP Mapping: 400 Bad Request

func PermissionDenied

func PermissionDenied(reason, format string, a ...interface{}) error

PermissionDenied The caller does not have permission to execute the specified operation. HTTP Mapping: 403 Forbidden

func Reason

func Reason(err error) string

Reason returns the status for a particular error. It supports wrapped errors.

func ResourceExhausted

func ResourceExhausted(reason, format string, a ...interface{}) error

ResourceExhausted Some resource has been exhausted, perhaps a per-user quota, or perhaps the entire file system is out of space. HTTP Mapping: 429 Too Many Requests

func Unauthorized

func Unauthorized(reason, format string, a ...interface{}) error

Unauthorized The request does not have valid authentication credentials for the operation. HTTP Mapping: 401 Unauthorized

func Unavailable

func Unavailable(reason, format string, a ...interface{}) error

Unavailable The service is currently unavailable. HTTP Mapping: 503 Service Unavailable

func Unimplemented

func Unimplemented(reason, format string, a ...interface{}) error

Unimplemented The operation is not implemented or is not supported/enabled in this service. HTTP Mapping: 501 Not Implemented

func Unknown

func Unknown(reason, format string, a ...interface{}) error

Unknown error. HTTP Mapping: 500 Internal Server Error

Types

type Status added in v2.2.2

type Status struct {
	Code    int32      `protobuf:"varint,1,opt,name=code,proto3" json:"code,omitempty"`
	Reason  string     `protobuf:"bytes,2,opt,name=reason,proto3" json:"reason,omitempty"`
	Message string     `protobuf:"bytes,3,opt,name=message,proto3" json:"message,omitempty"`
	Details []*any.Any `protobuf:"bytes,4,rep,name=details,proto3" json:"details,omitempty"`
	// contains filtered or unexported fields
}

func (*Status) Descriptor deprecated added in v2.2.2

func (*Status) Descriptor() ([]byte, []int)

Deprecated: Use Status.ProtoReflect.Descriptor instead.

func (*Status) GetCode added in v2.2.2

func (x *Status) GetCode() int32

func (*Status) GetDetails

func (x *Status) GetDetails() []*any.Any

func (*Status) GetMessage added in v2.2.2

func (x *Status) GetMessage() string

func (*Status) GetReason added in v2.2.2

func (x *Status) GetReason() string

func (*Status) ProtoMessage added in v2.2.2

func (*Status) ProtoMessage()

func (*Status) ProtoReflect added in v2.2.2

func (x *Status) ProtoReflect() protoreflect.Message

func (*Status) Reset added in v2.2.2

func (x *Status) Reset()

func (*Status) String added in v2.2.2

func (x *Status) String() string

type StatusError

type StatusError = Status

StatusError contains an error response from the server.

func FromError

func FromError(err error) (*StatusError, bool)

FromError returns status error.

func (*StatusError) Error

func (e *StatusError) Error() string

func (*StatusError) HTTPStatus

func (e *StatusError) HTTPStatus() int

HTTPStatus returns the Status represented by se.

func (*StatusError) Is

func (e *StatusError) Is(target error) bool

Is matches each error in the chain with the target value.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL