errors

package
v0.0.0-...-5023f9f Latest Latest
Warning

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

Go to latest
Published: Jul 24, 2022 License: MIT Imports: 2 Imported by: 0

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

This section is empty.

Functions

func Aborted

func Aborted(reason, message string) 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, message string) 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, message string) error

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

func DataLoss

func DataLoss(reason, message string) error

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

func DeadlineExceeded

func DeadlineExceeded(reason, message string) error

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

func Error

func Error(code int, message string, details ...interface{}) error

Error returns a Status representing c and msg.

func Errorf

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

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

func FailedPrecondition

func FailedPrecondition(reason, message string) 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, message string) 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, message string) error

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

func NotFound

func NotFound(reason, message string) error

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

func OutOfRange

func OutOfRange(reason, message string) 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, message string) error

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

func ResourceExhausted

func ResourceExhausted(reason, message string) 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, message string) error

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

func Unavailable

func Unavailable(reason, message string) error

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

func Unimplemented

func Unimplemented(reason, message string) 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, message string) error

Unknown error. HTTP Mapping: 500 Internal Server Error

Types

type ErrorInfo

type ErrorInfo struct {
	// Reason is the typed error code. For example: "some_example".
	Reason string `json:"reason"`
	// Message is the human-readable description of the error.
	Message string `json:"message"`
}

ErrorInfo is a detailed error code & message from the API frontend.

func Reason

func Reason(err error) *ErrorInfo

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

type StatusError

type StatusError struct {
	// Code is the gRPC response status code and will always be populated.
	Code int `json:"code"`
	// Message is the server response message and is only populated when
	// explicitly referenced by the JSON server response.
	Message string `json:"message"`
	// Details provide more context to an error.
	Details []interface{} `json:"details"`
}

StatusError contains an error response from the server.

func (*StatusError) Error

func (e *StatusError) Error() string

func (*StatusError) Is

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

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

func (*StatusError) WithDetails

func (e *StatusError) WithDetails(details ...interface{})

WithDetails provided details messages appended to the errors.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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