errors

package
v1.0.3 Latest Latest
Warning

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

Go to latest
Published: Apr 28, 2026 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrNotFound           = stdErrors.New("not found")
	ErrUnauthorized       = stdErrors.New("unauthorized")
	ErrPermissionDenied   = stdErrors.New("permission denied")
	ErrInvalidArgument    = stdErrors.New("invalid argument")
	ErrAlreadyExists      = stdErrors.New("already exists")
	ErrServiceUnavailable = stdErrors.New("service unavailable")
	ErrInternal           = stdErrors.New("internal error")
	ErrTokenExpired       = stdErrors.New("token expired")
	ErrTokenInvalid       = stdErrors.New("token invalid")
	ErrTokenRevoked       = stdErrors.New("token revoked")
	ErrRateLimited        = stdErrors.New("rate limited")
	ErrTimeout            = stdErrors.New("timeout")
)

Functions

func GRPCCode

func GRPCCode(err error) codes.Code

func IsAlreadyExists

func IsAlreadyExists(err error) bool

func IsCanceled

func IsCanceled(err error) bool

func IsInternal

func IsInternal(err error) bool

func IsInvalidArgument

func IsInvalidArgument(err error) bool

func IsNotFound

func IsNotFound(err error) bool

func IsPermissionDenied

func IsPermissionDenied(err error) bool

func IsRateLimited

func IsRateLimited(err error) bool

func IsRetryable

func IsRetryable(err error) bool

func IsServiceUnavailable

func IsServiceUnavailable(err error) bool

func IsTimeout

func IsTimeout(err error) bool

func IsTokenExpired

func IsTokenExpired(err error) bool

func IsTokenInvalid

func IsTokenInvalid(err error) bool

func IsUnauthorized

func IsUnauthorized(err error) bool

func Message

func Message(err error) string

func ToHTTPStatus

func ToHTTPStatus(err error) int

func Wrap

func Wrap(err error) error

Wrap 将 gRPC 错误包装为 IAMError。

func WrapWithCode

func WrapWithCode(err error, code string, message string) error

WrapWithCode 使用自定义错误码包装错误。

Types

type IAMError

type IAMError struct {
	Code     string
	Message  string
	GRPCCode codes.Code
	Cause    error
}

IAMError 是 SDK 统一错误包装类型。

func AsIAMError

func AsIAMError(err error) (*IAMError, bool)

func (*IAMError) Error

func (e *IAMError) Error() string

func (*IAMError) Is

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

func (*IAMError) Unwrap

func (e *IAMError) Unwrap() error

Jump to

Keyboard shortcuts

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