verrors

package
v0.20.0 Latest Latest
Warning

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

Go to latest
Published: Mar 5, 2024 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrNoEntry        = errors.New("storage: no entry")
	ErrCorruptStorage = errors.New("storage: corrupt")
)

TODO (jun, pharrell): ErrAlreadyExists, ErrExist, ErrVMSStorageNode... - Use basic error? (ErrAlreadyExists, ErrExist, ...) - Use specific error? (ErrLogStreamAlreadyExists, ...)

View Source
var (
	ErrTrimmed          = errors.New("logstream: trimmed")
	ErrUndecidable      = errors.New("logstream: undecidable")
	ErrCorruptLogStream = errors.New("logstream: corrupt")
	ErrSealed           = errors.New("sealed")
	ErrUnordered        = errors.New("logstream: unordered scanner")
)
View Source
var (
	ErrInvalid     = errors.New("invalid argument")
	ErrExist       = errors.New("already exists")
	ErrNotExist    = errors.New("not exist")
	ErrUnavailable = errors.New("unavailable")
	ErrState       = errors.New("invalid state")
	ErrClosed      = errors.New("closed")

	ErrIgnore     = errors.New("ignore")
	ErrInprogress = errors.New("inprogress")
	ErrNeedRetry  = errors.New("need retry")
	ErrStopped    = errors.New("stopped")
	ErrNotMember  = errors.New("not member")
	ErrNotEmpty   = errors.New("not empty")

	ErrInvalidArgument = errors.New("status - invalid argument")
	ErrAlreadyExists   = errors.New("status - varlogserver: already exists")

	ErrInternal = errors.New("status - internal error")
)

Functions

func FromStatusError

func FromStatusError(maybeStatusErr error) (err error)

FromStatusError converts an grpc/status.statusError into an error. There are below cases: - If maybeStatusErr is nil, it returns nil. - If maybeStatusErr is not type of grpc/status.statusError, it returns maybeStatusErr again. - In case of that maybeStatusErr is type of grpc/status.statusError:

  • try to parse Details field, and return an error if it is parsed
  • if the error is not parsed, and its code is either grpc/codes.DeadlineExceeded or grpc/codes.Canceled, FromStatusError returns context error
  • if the code is code.Unavailable, then wrap the error by transientError and return it

func IsTransient

func IsTransient(err error) bool

IsTransient checks if err is temporarily error.

func ToErr

func ToErr(ctx context.Context, err error) error

func ToStatusError

func ToStatusError(err error) error

ToStatusError converts an errors into grpc/status.statusError. It usually is used before sending responses via gRPC. If the err is either context.DeadlineExceeded or context.Canceled, it returns grpc/status.statusError having a code of either codes.DeadlineExceeded or codes.Canceled.

func ToStatusErrorWithCode

func ToStatusErrorWithCode(err error, code codes.Code) error

Types

This section is empty.

Jump to

Keyboard shortcuts

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