status

package
v1.28.0 Latest Latest
Warning

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

Go to latest
Published: Feb 27, 2024 License: Apache-2.0 Imports: 8 Imported by: 3

Documentation

Overview

Package status contains helpers functions to create grpc Status with contextual information, like traces.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewAlreadyExists added in v0.0.2

func NewAlreadyExists(ctx context.Context, err error, msg string) *rpc.Status

NewAlreadyExists returns a Status with CODE_ALREADY_EXISTS and logs the msg.

func NewConflict added in v0.0.2

func NewConflict(ctx context.Context, err error, msg string) *rpc.Status

NewConflict returns a Status with Code_CODE_ABORTED and logs the msg.

func NewErrorFromCode

func NewErrorFromCode(code rpc.Code, pkgname string) error

NewErrorFromCode returns a standardized Error for a given RPC code.

func NewFailedPrecondition added in v0.0.2

func NewFailedPrecondition(ctx context.Context, err error, msg string) *rpc.Status

NewFailedPrecondition TODO.

func NewInsufficientStorage added in v0.0.2

func NewInsufficientStorage(ctx context.Context, err error, msg string) *rpc.Status

NewInsufficientStorage returns a Status with INSUFFICIENT_STORAGE and logs the msg.

func NewInternal

func NewInternal(ctx context.Context, err error, msg string) *rpc.Status

NewInternal returns a Status with CODE_INTERNAL and logs the msg. In this case, err MUST be filled for tracking purposes.

func NewInvalid

func NewInvalid(ctx context.Context, msg string) *rpc.Status

NewInvalid returns a Status with CODE_INVALID_ARGUMENT and logs the msg.

func NewInvalidArg

func NewInvalidArg(ctx context.Context, msg string) *rpc.Status

NewInvalidArg returns a Status with CODE_INVALID_ARGUMENT.

func NewNotFound

func NewNotFound(ctx context.Context, msg string) *rpc.Status

NewNotFound returns a Status with CODE_NOT_FOUND and logs the msg.

func NewOK

func NewOK(ctx context.Context) *rpc.Status

NewOK returns a Status with CODE_OK.

func NewPermissionDenied added in v0.0.2

func NewPermissionDenied(ctx context.Context, err error, msg string) *rpc.Status

NewPermissionDenied returns a Status with PERMISSION_DENIED and logs the msg.

func NewStatusFromErrType added in v0.0.2

func NewStatusFromErrType(ctx context.Context, msg string, err error) *rpc.Status

NewStatusFromErrType returns a status that corresponds to the given errtype.

func NewUnauthenticated

func NewUnauthenticated(ctx context.Context, err error, msg string) *rpc.Status

NewUnauthenticated returns a Status with CODE_UNAUTHENTICATED and logs the msg.

func NewUnimplemented

func NewUnimplemented(ctx context.Context, err error, msg string) *rpc.Status

NewUnimplemented returns a Status with CODE_UNIMPLEMENTED and logs the msg.

Types

This section is empty.

Jump to

Keyboard shortcuts

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