status

package
v0.0.0-...-fe632b3 Latest Latest
Warning

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

Go to latest
Published: Feb 26, 2020 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Overview

Package status provides utility functions for google_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 GetDirectHTTPResponse

func GetDirectHTTPResponse(status rpc.Status) *v1beta1.DirectHttpResponse

GetDirectHTTPResponse extracts a client-facing error detail for HTTP or returns nil if it is not present.

func HTTPStatusFromCode

func HTTPStatusFromCode(code rpc.Code) int

HTTPStatusFromCode translates RPC status code to HTTP status code.

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 PackErrorDetail

func PackErrorDetail(response proto.Message) *types.Any

PackErrorDetail packs an HTTP response error detail

func String

func String(status rpc.Status) string

String produces a string representation of rpc.Status.

func WithAborted

func WithAborted(message string) rpc.Status

WithAborted returns an initialized status with the rpc.ABORTED code and the given message.

func WithAlreadyExists

func WithAlreadyExists(message string) rpc.Status

WithAlreadyExists returns an initialized status with the rpc.ALREADY_EXISTS code and the given 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 WithDataLoss

func WithDataLoss(message string) rpc.Status

WithDataLoss returns an initialized status with the rpc.DATA_LOSS code and the given 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 WithFailedPrecondition

func WithFailedPrecondition(message string) rpc.Status

WithFailedPrecondition returns an initialized status with the rpc.FAILED_PRECONDITION code and the given 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 WithNotFound

func WithNotFound(message string) rpc.Status

WithNotFound returns an initialized status with the rpc.NOT_FOUND code and the given message.

func WithOutOfRange

func WithOutOfRange(message string) rpc.Status

WithOutOfRange returns an initialized status with the rpc.OUT_OF_RANGE code and the given 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.

func WithUnauthenticated

func WithUnauthenticated(message string) rpc.Status

WithUnauthenticated returns an initialized status with the rpc.UNAUTHENTICATED code and the given message.

func WithUnavailable

func WithUnavailable(message string) rpc.Status

WithUnavailable returns an initialized status with the rpc.UNAVAILABLE code and the given message.

func WithUnimplemented

func WithUnimplemented(message string) rpc.Status

WithUnimplemented returns an initialized status with the rpc.UNIMPLEMENTED code and the given message.

func WithUnknown

func WithUnknown(message string) rpc.Status

WithUnknown returns an initialized status with the rpc.UNKNOWN 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