errors

package
v0.0.0-...-c935d06 Latest Latest
Warning

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

Go to latest
Published: Jul 31, 2024 License: Apache-2.0 Imports: 5 Imported by: 9

Documentation

Overview

Package errors provides a way to return detailed information for an RPC request error. The error is normally JSON encoded.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func As

func As(err error) (*pb.Error, bool)

As finds the first error in err's chain that matches *Error.

func BadRequest

func BadRequest(id, format string, a ...interface{}) error

BadRequest generates a 400 error.

func Conflict

func Conflict(id, format string, a ...interface{}) error

Conflict generates a 409 error.

func Equal

func Equal(err1 error, err2 error) bool

Equal tries to compare errors.

func Forbidden

func Forbidden(id, format string, a ...interface{}) error

Forbidden generates a 403 error.

func FromError

func FromError(err error) *pb.Error

FromError try to convert go error to *Error.

func InternalServerError

func InternalServerError(id, format string, a ...interface{}) error

InternalServerError generates a 500 error.

func MethodNotAllowed

func MethodNotAllowed(id, format string, a ...interface{}) error

MethodNotAllowed generates a 405 error.

func New

func New(id, detail string, code int32) error

New generates a custom error.

func NewMultiError

func NewMultiError() *pb.MultiError

func NotFound

func NotFound(id, format string, a ...interface{}) error

NotFound generates a 404 error.

func Parse

func Parse(err string) *pb.Error

Parse tries to parse a JSON string into an error. If that fails, it will set the given string as the error detail.

func Timeout

func Timeout(id, format string, a ...interface{}) error

Timeout generates a 408 error.

func Unauthorized

func Unauthorized(id, format string, a ...interface{}) error

Unauthorized generates a 401 error.

Types

This section is empty.

Jump to

Keyboard shortcuts

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