status

package
v0.0.0-...-d6fd5ef Latest Latest
Warning

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

Go to latest
Published: May 31, 2017 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Overview

Package status provides utility functions for RPC status objects.

Index

Constants

This section is empty.

Variables

View Source
var OK = rpc.Status{Code: int32(rpc.OK)}

OK represents a status with a code of rpc.OK

Functions

func InvalidWithDetails

func InvalidWithDetails(msg string, pb proto.Message) rpc.Status

InvalidWithDetails builds a google.rpc.Status proto with the provided message and the `details` field populated with the supplied proto message. NOTE: if there is an issue marshaling the proto to a google.protobuf.Any, the returned Status message will not have the `details` field populated.

func IsOK

func IsOK(status rpc.Status) bool

IsOK returns true is the given status has the code rpc.OK

func New

func New(c rpc.Code) rpc.Status

New returns an initialized status with the given error code.

func NewBadRequest

func NewBadRequest(field string, err error) *rpc.BadRequest

NewBadRequest builds a google.rpc.BadRequest proto. BadRequest proto messages can be used to populate the `details` field in a google.rpc.Status message.

func WithCancelled

func WithCancelled(message string) rpc.Status

WithCancelled returns an initialized status with the rpc.CANCELLED error code and the error's message.

func WithDeadlineExceeded

func WithDeadlineExceeded(message string) rpc.Status

WithDeadlineExceeded returns an initialized status with the rpc.DEADLINE_EXCEEDED code and the given message.

func WithError

func WithError(err error) rpc.Status

WithError returns an initialized status with the rpc.INTERNAL error code and the error's message.

func WithInternal

func WithInternal(message string) rpc.Status

WithInternal returns an initialized status with the rpc.INTERNAL error code and the error's message.

func WithInvalidArgument

func WithInvalidArgument(message string) rpc.Status

WithInvalidArgument returns an initialized status with the rpc.INVALID_ARGUMENT code and the given message.

func WithMessage

func WithMessage(c rpc.Code, message string) rpc.Status

WithMessage returns an initialized status with the given error code and message

func WithPermissionDenied

func WithPermissionDenied(message string) rpc.Status

WithPermissionDenied returns an initialized status with the rpc.PERMISSION_DENIED code and the given message.

func WithResourceExhausted

func WithResourceExhausted(message string) rpc.Status

WithResourceExhausted returns an initialized status with the rpc.PERMISSION_DENIED code and the given message.

Types

This section is empty.

Jump to

Keyboard shortcuts

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