status

package
v0.0.0-...-cf28ba7 Latest Latest
Warning

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

Go to latest
Published: Apr 9, 2020 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Convert

func Convert(c codes.Code, err error) *status.Status

Convert is a convenience function which removes the need to handle the boolean return value from FromError.

func Errore

func Errore(c codes.Code, err error, details ...proto.Message) error

Errore returns an error representing c and error. If err is nil, returns nil.

func FromError

func FromError(c codes.Code, err error) (s *status.Status, ok bool)

FromError returns a Status representing err if it was produced from this package or has a method `GRPCStatus() *Status`. Otherwise, ok is false and a Status is returned with code.Code and the original error message.

func Newe

func Newe(c codes.Code, err error, details ...proto.Message) *status.Status

Newe returns a Status representing c and error, that is . if err == nil, return codes.OK if err != nil but c == codes.OK, return codes.Internal otherwise, return c

func WithBadRequestDetails

func WithBadRequestDetails(s *status.Status, fields ...errdetails.BadRequest_FieldViolation) *status.Status

WithBadRequestDetails returns a new status with the provided bad requests messages appended to the status.

func WithDetails

func WithDetails(s *status.Status, details ...proto.Message) *status.Status

WithDetails returns a new status with the provided details messages appended to the status. If any errors are encountered, it returns original status. WithDetails does not change original code always.

Types

This section is empty.

Jump to

Keyboard shortcuts

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