Documentation ¶
Overview ¶
Package status contains helpers functions to create grpc Status with contextual information, like traces.
Index ¶
- func NewAlreadyExists(ctx context.Context, err error, msg string) *rpc.Status
- func NewConflict(ctx context.Context, err error, msg string) *rpc.Status
- 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, err error, msg string) *rpc.Status
- func NewInvalid(ctx context.Context, msg string) *rpc.Status
- func NewInvalidArg(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 NewAlreadyExists ¶ added in v0.0.2
NewAlreadyExists returns a Status with CODE_ALREADY_EXISTS and logs the msg.
func NewConflict ¶ added in v0.0.2
NewConflict returns a Status with Code_CODE_ABORTED and logs the msg.
func NewErrorFromCode ¶
NewErrorFromCode returns a standardized Error for a given RPC code.
func NewFailedPrecondition ¶ added in v0.0.2
NewFailedPrecondition TODO
func NewInsufficientStorage ¶ added in v0.0.2
NewInsufficientStorage returns a Status with INSUFFICIENT_STORAGE and logs the msg.
func NewInternal ¶
NewInternal returns a Status with CODE_INTERNAL and logs the msg. In this case, err MUST be filled for tracking purposes.
func NewInvalid ¶
NewInvalid returns a Status with CODE_INVALID_ARGUMENT and logs the msg.
func NewInvalidArg ¶
NewInvalidArg returns a Status with CODE_INVALID_ARGUMENT.
func NewNotFound ¶
NewNotFound returns a Status with CODE_NOT_FOUND and logs the msg.
func NewPermissionDenied ¶ added in v0.0.2
NewPermissionDenied returns a Status with PERMISSION_DENIED and logs the msg.
func NewStatusFromErrType ¶ added in v0.0.2
NewStatusFromErrType returns a status that corresponds to the given errtype
func NewUnauthenticated ¶
NewUnauthenticated returns a Status with CODE_UNAUTHENTICATED and logs the msg.
Types ¶
This section is empty.