errors

package
Version: v0.16.1 Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// Unwrap is an alias for errors.Unwrap
	Unwrap = errors.Unwrap

	// Is is an alias for errors.Is
	Is = errors.Is

	// As is an alias for errors.As
	As = errors.As
)
View Source
var (

	// Unknown indicates an unknown error.
	Unknown = New(codes.Unknown, codes.Unknown.String())

	// InvalidArgument indicates missing or malformed field in a request.
	InvalidArgument = New(codes.InvalidArgument, codes.InvalidArgument.String())

	// NotFound indicates that the requested resource does not exist.
	NotFound = New(codes.NotFound, codes.NotFound.String())

	// AlreadyExists indicates that the request to be created already exits.
	AlreadyExists = New(codes.AlreadyExists, codes.AlreadyExists.String())

	// Unimplemented indicates the requested service has not been implemented.
	Unimplemented = New(codes.Unimplemented, codes.Unimplemented.String())

	// Internal indicates an internal errors.
	Internal = New(codes.Internal, codes.Internal.String())
)

Functions

func Errorf

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

Errorf creates an error from the code and a format specifier.

func New

func New(code codes.Code, msg string) error

New creates an error from the code and the message.

func WithCode

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

WithCode annotates the given error with the code.

func Wrap

func Wrap(e error, msg string) error

Wrap returns an error wrapped with the supplied message. If the given error is nil, Wrap returns nil.

func Wrapf

func Wrapf(e error, format string, a ...interface{}) error

Wrap returns an error wrapped with the format specifier. If the given error is nil, Wrap returns nil.

Types

This section is empty.

Source Files

Jump to

Keyboard shortcuts

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