rpcstatus

package
v0.0.0-...-0a3388d Latest Latest
Warning

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

Go to latest
Published: Sep 27, 2024 License: MIT Imports: 6 Imported by: 34

Documentation

Overview

Package rpcstatus contains status code definitions for rpc.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Error

func Error(code StatusCode, msg string) error

Error wraps the message with a status code into an error.

func Errorf

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

Errorf : Error :: fmt.Sprintf : fmt.Sprint.

func Wrap

func Wrap(code StatusCode, err error) error

Wrap wraps the error with the provided status code.

Types

type StatusCode

type StatusCode uint64

StatusCode is an enumeration of rpc status codes.

const (
	Unknown            StatusCode = 0
	OK                 StatusCode = 1
	Canceled           StatusCode = 2
	InvalidArgument    StatusCode = 3
	DeadlineExceeded   StatusCode = 4
	NotFound           StatusCode = 5
	AlreadyExists      StatusCode = 6
	PermissionDenied   StatusCode = 7
	ResourceExhausted  StatusCode = 8
	FailedPrecondition StatusCode = 9
	Aborted            StatusCode = 10
	OutOfRange         StatusCode = 11
	Unimplemented      StatusCode = 12
	Internal           StatusCode = 13
	Unavailable        StatusCode = 14
	DataLoss           StatusCode = 15
	Unauthenticated    StatusCode = 16
	MethodNotAllowed   StatusCode = 17

	ObjectLockEndpointsDisabled                   StatusCode = 10000
	ObjectLockDisabledForProject                  StatusCode = 10001
	ObjectLockInvalidBucketState                  StatusCode = 10002
	ObjectLockBucketRetentionConfigurationMissing StatusCode = 10003
	ObjectLockObjectRetentionConfigurationMissing StatusCode = 10004
	ObjectLockObjectProtected                     StatusCode = 10005
	ObjectLockInvalidObjectState                  StatusCode = 10006
	ObjectLockInvalidBucketRetentionConfiguration StatusCode = 10007
)

These constants are all the rpc error codes. It is important that their numerical values do not change.

func Code

func Code(err error) StatusCode

Code returns the status code associated with the error.

func (StatusCode) String

func (i StatusCode) String() string

Jump to

Keyboard shortcuts

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