errors

package
Version: v0.5.0 Latest Latest
Warning

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

Go to latest
Published: Jun 27, 2021 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (

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

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

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

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

	// ErrUnimplemented 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 As added in v0.4.0

func As(err error, target interface{}) bool

As arovides a local implementation of the standard errors function to allow users to import a single errors package.

func Errorf

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

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

func Is added in v0.4.0

func Is(err, target error) bool

Is provides a local implementation of the standard errors function to allow users to import a single errors package.

func New

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

New creates an error from the code and the message.

func Unwrap added in v0.4.0

func Unwrap(err error) error

Unwrap provides a local implementation of the standard errors function to allow users to import a single errors package.

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