Documentation
¶
Index ¶
- func FilterUnavailableErrorCode(rpcErr error) error
- func GetCode(rpcErr error) codes.Code
- func HasCode(rpcErr error, code codes.Code) bool
- func WrapCancelled(err error) error
- func WrapFailedPrecondition(err error) error
- func WrapInternalError(err error) error
- func WrapInvalidArgument(err error) error
- func WrapNotFound(err error) error
- func WrapResourceExhaustedOrCancelled(ctx context.Context, err error) error
- func WrapUnimplemented(err error) error
- func WrapWithContext(err error, context string) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func FilterUnavailableErrorCode ¶
FilterUnavailableErrorCode rpc error that caused due to transient connectivity issue.
func WrapCancelled ¶
WrapCancelled creates a grpc error with a codes.Canceled status code for a given error.
func WrapFailedPrecondition ¶ added in v0.1.8
WrapFailedPrecondition creates a grpc error with a codes.FailedPrecondition status code for a given error.
func WrapInternalError ¶
WrapInternalError creates a grpc error with a codes.Internal status code for a given error.
func WrapInvalidArgument ¶
WrapInvalidArgument creates a grpc error with a codes.InvalidArgument status code for a given error.
func WrapNotFound ¶ added in v0.1.8
WrapNotFound creates a grpc error with a codes.NotFound status code for a given error.
func WrapResourceExhaustedOrCancelled ¶ added in v0.1.9
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
WrapUnimplemented creates a grpc error with a codes.Unimplemented status code for a given error.
func WrapWithContext ¶ added in v0.1.8
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.