Documentation ¶
Overview ¶
Package status contains helpers functions to create grpc Status with contextual information, like traces.
Index ¶
- func HTTPStatusFromCode(code rpc.Code) int
- func NewAborted(ctx context.Context, err error, msg string) *rpc.Status
- func NewAlreadyExists(ctx context.Context, err error, msg string) *rpc.Status
- func NewConflict(ctx context.Context, err error, msg string) *rpc.Statusdeprecated
- func NewErrorFromCode(code rpc.Code, pkgname string) error
- func NewFailedPrecondition(ctx context.Context, err error, msg string) *rpc.Status
- func NewInsufficientStorage(ctx context.Context, err error, msg string) *rpc.Status
- func NewInternal(ctx context.Context, msg string) *rpc.Status
- func NewInvalid(ctx context.Context, msg string) *rpc.Status
- func NewNotFound(ctx context.Context, msg string) *rpc.Status
- func NewOK(ctx context.Context) *rpc.Status
- func NewPermissionDenied(ctx context.Context, err error, msg string) *rpc.Status
- func NewStatusFromErrType(ctx context.Context, msg string, err error) *rpc.Status
- func NewUnauthenticated(ctx context.Context, err error, msg string) *rpc.Status
- func NewUnimplemented(ctx context.Context, err error, msg string) *rpc.Status
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func HTTPStatusFromCode ¶
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
NewAborted returns a Status with ABORTED.
func NewAlreadyExists ¶
NewAlreadyExists returns a Status with CODE_ALREADY_EXISTS.
func NewErrorFromCode ¶
NewErrorFromCode returns a standardized Error for a given RPC code.
func NewFailedPrecondition ¶
NewFailedPrecondition returns a Status with FAILED_PRECONDITION.
func NewInsufficientStorage ¶
NewInsufficientStorage returns a Status with INSUFFICIENT_STORAGE.
func NewInternal ¶
NewInternal returns a Status with CODE_INTERNAL.
func NewInvalid ¶
NewInvalid returns a Status with CODE_INVALID_ARGUMENT.
func NewNotFound ¶
NewNotFound returns a Status with CODE_NOT_FOUND.
func NewPermissionDenied ¶
NewPermissionDenied returns a Status with PERMISSION_DENIED.
func NewStatusFromErrType ¶
NewStatusFromErrType returns a status that corresponds to the given errtype
func NewUnauthenticated ¶
NewUnauthenticated returns a Status with CODE_UNAUTHENTICATED.
Types ¶
This section is empty.