except

package
v0.0.0-...-de24375 Latest Latest
Warning

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

Go to latest
Published: Jul 11, 2024 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ReasonString = map[except.Reason]string{
	except.Reason_UNKNOWN:        "unknown",
	except.Reason_NOT_FOUND:      "not found",
	except.Reason_INVALID:        "invalid",
	except.Reason_INTERNAL:       "internal",
	except.Reason_TIMEOUT:        "timeout",
	except.Reason_ALREADY_EXISTS: "already exists",
	except.Reason_ABORTED:        "aborted",
	except.Reason_FAILED:         "failed",
}

Functions

func GrpcCodeToReason

func GrpcCodeToReason(c codes.Code) except.Reason

func HasReason

func HasReason(err error, r ...except.Reason) bool

HasReason returns true if r matches err. err must be an Err.

func New

func New(reason except.Reason, msg string) error

func NewAborted

func NewAborted(msg string, args ...any) error

func NewAlreadyExists

func NewAlreadyExists(msg string, args ...any) error

func NewFailed

func NewFailed(msg string, args ...any) error

func NewInternal

func NewInternal(msg string, args ...any) error

func NewInvalid

func NewInvalid(msg string, args ...any) error

func NewNotFound

func NewNotFound(msg string, args ...any) error

func NewTimeout

func NewTimeout(msg string, args ...any) error

func Newf

func Newf(reason except.Reason, msg string, args ...any) error

func Reason

func Reason(err error) except.Reason

func ReasonToGrpcCode

func ReasonToGrpcCode(r except.Reason) codes.Code

Types

type Err

type Err struct {
	except.Exception
}

func NewFromGrpcStatus

func NewFromGrpcStatus(st *status.Status) *Err

func (*Err) Error

func (e *Err) Error() string

Jump to

Keyboard shortcuts

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