grpcerror

package
v0.2.0 Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func FilterUnavailableErrorCode

func FilterUnavailableErrorCode(rpcErr error) error

FilterUnavailableErrorCode rpc error that caused due to transient connectivity issue.

func GetCode

func GetCode(rpcErr error) codes.Code

GetCode returns GRPC error code.

func HasCode

func HasCode(rpcErr error, code codes.Code) bool

HasCode returns true if the rpcErr holds the given code.

func WrapCancelled

func WrapCancelled(err error) error

WrapCancelled creates a grpc error with a codes.Canceled status code for a given error.

func WrapFailedPrecondition added in v0.1.8

func WrapFailedPrecondition(err error) error

WrapFailedPrecondition creates a grpc error with a codes.FailedPrecondition status code for a given error.

func WrapInternalError

func WrapInternalError(err error) error

WrapInternalError creates a grpc error with a codes.Internal status code for a given error.

func WrapInvalidArgument

func WrapInvalidArgument(err error) error

WrapInvalidArgument creates a grpc error with a codes.InvalidArgument status code for a given error.

func WrapNotFound added in v0.1.8

func WrapNotFound(err error) error

WrapNotFound creates a grpc error with a codes.NotFound status code for a given error.

func WrapResourceExhaustedOrCancelled added in v0.1.9

func WrapResourceExhaustedOrCancelled(ctx context.Context, err error) error

WrapResourceExhaustedOrCancelled returns a codes.Canceled gRPC error if the context is done, otherwise returns a codes.ResourceExhausted gRPC error.

func WrapUnimplemented added in v0.1.8

func WrapUnimplemented(err error) error

WrapUnimplemented creates a grpc error with a codes.Unimplemented status code for a given error.

func WrapWithContext added in v0.1.8

func WrapWithContext(err error, context string) error

WrapWithContext wraps an error from a downstream gRPC call while preserving the original status code if present. This is useful for middleware services that call other gRPC services and need to pass through errors to upstream clients. If the error is a gRPC status error, it logs the status code and message, preserves the status code and adds context to the message. If the error is not a gRPC status error (e.g., network timeout), it wraps it as Internal.

Types

This section is empty.

Jump to

Keyboard shortcuts

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