status

package
v0.6.0 Latest Latest
Warning

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

Go to latest
Published: Feb 7, 2024 License: BSD-3-Clause Imports: 5 Imported by: 0

Documentation

Overview

Package status extends google.golang.org/grpc/status

Index

Constants

This section is empty.

Variables

View Source
var (
	// New returns a Status representing c and msg.
	New = status.New

	// Newf returns New(c, fmt.Sprintf(format, a...)).
	Newf = status.Newf

	// Error returns an error representing c and msg.  If c is OK, returns nil.
	Error = status.Error

	// Errorf returns Error(c, fmt.Sprintf(format, a...)).
	Errorf = status.Errorf

	// ErrorProto returns an error representing s.  If s.Code is OK, returns nil.
	ErrorProto = status.ErrorProto

	// FromProto returns a Status representing s.
	FromProto = status.FromProto

	// FromError returns a Status representing err if it was produced from this
	// package or has a method `GRPCStatus() *Status`. Otherwise, ok is false and a
	// Status is returned with codes.Unknown and the original error message.
	FromError = status.FromError

	// Convert is a convenience function which removes the need to handle the
	// boolean return value from FromError.
	Convert = status.Convert

	// Code returns the Code of the error if it is a Status error, codes.OK if err
	// is nil, or codes.Unknown otherwise.
	Code = status.Code

	// FromContextError converts a context error into a Status.  It returns a
	// Status with codes.OK if err is nil, or a Status with codes.Unknown if err is
	// non-nil and not a context error.
	FromContextError = status.FromContextError
)

Functions

func ErrorDetailString

func ErrorDetailString(err error) string

ErrorDetailString returns err.Error() with details message if err is Status

func IsAborted added in v0.4.4

func IsAborted(err error) bool

IsAborted return true if Status.Code equals codes.Aborted, else false

func IsAlreadyExists added in v0.4.4

func IsAlreadyExists(err error) bool

IsAlreadyExists return true if Status.Code equals codes.AlreadyExists, else false

func IsCanceled added in v0.4.4

func IsCanceled(err error) bool

IsCanceled return true if Status.Code equals codes.Canceled, else false

func IsDataLoss added in v0.4.4

func IsDataLoss(err error) bool

IsDataLoss return true if Status.Code equals codes.DataLoss, else false

func IsDeadlineExceeded added in v0.4.4

func IsDeadlineExceeded(err error) bool

IsDeadlineExceeded return true if Status.Code equals codes.DeadlineExceeded, else false

func IsFailedPrecondition added in v0.4.4

func IsFailedPrecondition(err error) bool

IsFailedPrecondition return true if Status.Code equals codes.FailedPrecondition, else false

func IsInternal added in v0.4.4

func IsInternal(err error) bool

IsInternal return true if Status.Code equals codes.Internal, else false

func IsInvalidArgument added in v0.4.4

func IsInvalidArgument(err error) bool

IsInvalidArgument return true if Status.Code equals codes.InvalidArgument, else false

func IsNotFound

func IsNotFound(err error) bool

IsNotFound return true if Status.Code equals codes.NotFound, else false

func IsOK added in v0.4.4

func IsOK(err error) bool

IsOK return true if Status.Code equals codes.OK, else false

func IsOutOfRange added in v0.4.4

func IsOutOfRange(err error) bool

IsOutOfRange return true if Status.Code equals codes.OutOfRange, else false

func IsPermissionDenied added in v0.4.4

func IsPermissionDenied(err error) bool

IsPermissionDenied return true if Status.Code equals codes.PermissionDenied, else false

func IsResourceExhausted added in v0.4.4

func IsResourceExhausted(err error) bool

IsResourceExhausted return true if Status.Code equals codes.ResourceExhausted, else false

func IsUnauthenticated added in v0.4.4

func IsUnauthenticated(err error) bool

IsUnauthenticated return true if Status.Code equals codes.Unauthenticated, else false

func IsUnavailable added in v0.4.4

func IsUnavailable(err error) bool

IsUnavailable return true if Status.Code equals codes.Unavailable, else false

func IsUnimplemented added in v0.4.4

func IsUnimplemented(err error) bool

IsUnimplemented return true if Status.Code equals codes.Unimplemented, else false

func IsUnknown added in v0.4.4

func IsUnknown(err error) bool

IsUnknown return true if Status.Code equals codes.Unknown, else false

Types

type BadRequest

type BadRequest = errdetails.BadRequest

BadRequest describes violations in a client request.

type DebugInfo

type DebugInfo = errdetails.DebugInfo

DebugInfo describes additional debugging info.

type ErrorInfo

type ErrorInfo = errdetails.ErrorInfo

ErrorInfo describes the cause of the error with structured details.

type Help

type Help = errdetails.Help

Help provides links to documentation or for performing an out of band action.

type LocalizedMessage

type LocalizedMessage = errdetails.LocalizedMessage

LocalizedMessage provides a localized error message that is safe to return to the user which can be attached to an RPC error.

type PreconditionFailure

type PreconditionFailure = errdetails.PreconditionFailure

PreconditionFailure describes what preconditions have failed.

type QuotaFailure

type QuotaFailure = errdetails.QuotaFailure

QuotaFailure describes how a quota check failed.

type RequestInfo

type RequestInfo = errdetails.RequestInfo

RequestInfo contains metadata about the request that clients can attach when filing a bug or providing other forms of feedback.

type ResourceInfo

type ResourceInfo = errdetails.ResourceInfo

ResourceInfo describes the resource that is being accessed.

type RetryInfo

type RetryInfo = errdetails.RetryInfo

RetryInfo describes when the clients can retry a failed request.

type Status

type Status = status.Status

Status references google.golang.org/grpc/internal/status. It represents an RPC status code, message, and details. It is immutable and should be created with New, Newf, or FromProto. https://godoc.org/google.golang.org/grpc/internal/status

func Aborted

func Aborted(format string, a ...any) *Status

Aborted returns a Status Aborted

func AlreadyExists

func AlreadyExists(format string, a ...any) *Status

AlreadyExists returns a Status AlreadyExists

func Canceled added in v0.4.4

func Canceled(format string, a ...any) *Status

Canceled returns a Status Canceled

func DataLoss added in v0.4.4

func DataLoss(format string, a ...any) *Status

DataLoss returns a Status DataLoss

func DeadlineExceeded added in v0.4.4

func DeadlineExceeded(format string, a ...any) *Status

DeadlineExceeded returns a Status DeadlineExceeded

func FailedPrecondition

func FailedPrecondition(format string, a ...any) *Status

FailedPrecondition returns a Status FailedPrecondition

func Internal

func Internal(format string, a ...any) *Status

Internal returns a Status Internal

func InvalidArgument

func InvalidArgument(format string, a ...any) *Status

InvalidArgument returns a Status InvalidArgument

func NotFound

func NotFound(format string, a ...any) *Status

NotFound returns a Status NotFound

func OK

func OK() *Status

OK returns a Status Ok

func OutOfRange

func OutOfRange(format string, a ...any) *Status

OutOfRange returns a Status OutOfRange

func PermissionDenied added in v0.1.1

func PermissionDenied(format string, a ...any) *Status

PermissionDenied returns a Status PermissionDenied

func ResourceExhausted

func ResourceExhausted(format string, a ...any) *Status

ResourceExhausted returns a Status ResourceExhausted

func Unauthenticated added in v0.1.1

func Unauthenticated(format string, a ...any) *Status

Unauthenticated returns a Status Unauthenticated

func Unavailable added in v0.4.4

func Unavailable(format string, a ...any) *Status

Unavailable returns a Status Unavailable

func Unimplemented

func Unimplemented(format string, a ...any) *Status

Unimplemented returns a Status Unimplemented

func Unknown added in v0.4.4

func Unknown(format string, a ...any) *Status

Unknown returns a Status Unknown

Jump to

Keyboard shortcuts

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