Documentation ¶
Overview ¶
Package status provides utility functions for RPC status objects.
Index ¶
- Variables
- func InvalidWithDetails(msg string, pb proto.Message) rpc.Status
- func IsOK(status rpc.Status) bool
- func New(c rpc.Code) rpc.Status
- func NewBadRequest(field string, err error) *rpc.BadRequest
- func WithCancelled(message string) rpc.Status
- func WithDeadlineExceeded(message string) rpc.Status
- func WithError(err error) rpc.Status
- func WithInternal(message string) rpc.Status
- func WithInvalidArgument(message string) rpc.Status
- func WithMessage(c rpc.Code, message string) rpc.Status
- func WithPermissionDenied(message string) rpc.Status
- func WithResourceExhausted(message string) rpc.Status
Constants ¶
This section is empty.
Variables ¶
OK represents a status with a code of rpc.OK
Functions ¶
func InvalidWithDetails ¶
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 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 ¶
WithCancelled returns an initialized status with the rpc.CANCELLED error code and the error's message.
func WithDeadlineExceeded ¶
WithDeadlineExceeded returns an initialized status with the rpc.DEADLINE_EXCEEDED code and the given message.
func WithError ¶
WithError returns an initialized status with the rpc.INTERNAL error code and the error's message.
func WithInternal ¶
WithInternal returns an initialized status with the rpc.INTERNAL error code and the error's message.
func WithInvalidArgument ¶
WithInvalidArgument returns an initialized status with the rpc.INVALID_ARGUMENT code and the given message.
func WithMessage ¶
WithMessage returns an initialized status with the given error code and message
func WithPermissionDenied ¶
WithPermissionDenied returns an initialized status with the rpc.PERMISSION_DENIED code and the given message.
func WithResourceExhausted ¶
WithResourceExhausted returns an initialized status with the rpc.PERMISSION_DENIED code and the given message.
Types ¶
This section is empty.