rpcstatus

package
v0.0.0-...-37afb3c Latest Latest
Warning

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

Go to latest
Published: Feb 7, 2025 License: MIT Imports: 6 Imported by: 33

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 NamedError

func NamedError(name string, code StatusCode, msg string) error

NamedError creates and returns an error wrapped with a defined monkit class name and status code.

func NamedErrorf

func NamedErrorf(name string, code StatusCode, format string, a ...any) error

NamedErrorf creates and returns an error wrapped with a defined monkit class name and status code.

func NamedWrap

func NamedWrap(name string, code StatusCode, err error) error

NamedWrap returns the err error wrapped with a defined monkit class name and status code.

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
	ObjectLockUploadWithTTL                          StatusCode = 10008
	ObjectLockUploadWithTTLAPIKey                    StatusCode = 10009
	ObjectLockUploadWithTTLAndDefaultRetention       StatusCode = 10010
	ObjectLockUploadWithTTLAPIKeyAndDefaultRetention StatusCode = 10011

	PlacementInvalidValue      StatusCode = 10012
	PlacementConflictingValues StatusCode = 10013
)

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