status

package
v2.7.4 Latest Latest
Warning

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

Go to latest
Published: Aug 10, 2022 License: Apache-2.0 Imports: 8 Imported by: 6

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 HTTPStatusFromCode

func HTTPStatusFromCode(code rpc.Code) int

HTTPStatusFromCode returns an HTTP status code for the rpc code. It returns an internal server error (500) if the code is unknown

func NewAborted added in v2.6.1

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

NewAborted returns a Status with ABORTED.

func NewAlreadyExists

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

NewAlreadyExists returns a Status with CODE_ALREADY_EXISTS.

func NewConflict deprecated

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

NewConflict returns a Status with Code_CODE_ABORTED.

Deprecated: NewConflict exists for historical compatibility and should not be used. To create a Status with code ABORTED, use NewAborted.

func NewErrorFromCode

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

NewErrorFromCode returns a standardized Error for a given RPC code.

func NewFailedPrecondition

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

NewFailedPrecondition returns a Status with FAILED_PRECONDITION.

func NewInsufficientStorage

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

NewInsufficientStorage returns a Status with INSUFFICIENT_STORAGE.

func NewInternal

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

NewInternal returns a Status with CODE_INTERNAL.

func NewInvalid

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

NewInvalid returns a Status with CODE_INVALID_ARGUMENT.

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.

func NewOK

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

NewOK returns a Status with CODE_OK.

func NewPermissionDenied

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

NewPermissionDenied returns a Status with PERMISSION_DENIED.

func NewStatusFromErrType

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.

func NewUnimplemented

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

NewUnimplemented returns a Status with CODE_UNIMPLEMENTED.

Types

This section is empty.

Jump to

Keyboard shortcuts

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