errors

package module
v0.0.0-...-42fad05 Latest Latest
Warning

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

Go to latest
Published: May 10, 2021 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// env-var variable that automatically enables returning the embedded details
	GOOGLE_ENABLE_ERROR_DETAIL = "GOOGLE_ENABLE_ERROR_DETAIL"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Error

type Error struct {
	Err         error
	PrettyPrint bool
	ReInterpret bool
	// contains filtered or unexported fields
}

Error contains an error response from the server.

func New

func New(err Error) *Error

New creates structured Error object of either googleapis.Error or google.rpc.Status

func NewWithClient

func NewWithClient(ctx context.Context, client interface{}, err Error) *Error

func (*Error) Error

func (r *Error) Error() string

func (*Error) GetGoogleAPIError

func (r *Error) GetGoogleAPIError() (*googleapi.Error, error)

GetGoogleAPIError returns base googleauis.Error

func (*Error) GetGoogleRPCBadRequest

func (r *Error) GetGoogleRPCBadRequest() (*errdetails.BadRequest, error)

GetGoogleRPCBadRequest returns google.rpc.BadRequest

func (*Error) GetGoogleRPCDebugInfo

func (r *Error) GetGoogleRPCDebugInfo() (*errdetails.DebugInfo, error)

GetGoogleRPCDebugInfo returns google.rpc.DebugInfo

func (*Error) GetGoogleRPCErrorInfo

func (r *Error) GetGoogleRPCErrorInfo() (*errdetails.ErrorInfo, error)

GetGoogleRPCErrorInfo returns google.rpc.ErrorInfo

func (*Error) GetGoogleRPCHelp

func (r *Error) GetGoogleRPCHelp() (*errdetails.Help, error)

GetGoogleRPCHelp returns google.rpc.Help

func (*Error) GetGoogleRPCPreconditionFailure

func (r *Error) GetGoogleRPCPreconditionFailure() (*errdetails.PreconditionFailure, error)

GetGoogleRPCPreconditionFailure returns google.rpc.PreconditionFailure

func (*Error) GetGoogleRPCQuotaFailure

func (r *Error) GetGoogleRPCQuotaFailure() (*errdetails.QuotaFailure, error)

GetGoogleRPCQuotaFailure returns google.rpc.QuotaFailure

func (*Error) GetGoogleRPCRetryInfo

func (r *Error) GetGoogleRPCRetryInfo() (*errdetails.RetryInfo, error)

GetGoogleRPCRetryInfo returns google.rpc.RetryInfo

func (*Error) GetReInterpretedErrors

func (r *Error) GetReInterpretedErrors() (string, error)

GetReInterpretedErrors returns []ReInterpretedError

func (*Error) GetStatus

func (r *Error) GetStatus() (*status.Status, error)

GetStatus returns base google.rpc.Status

func (*Error) IsGoogleAPIError

func (r *Error) IsGoogleAPIError() bool

func (*Error) IsStatusError

func (r *Error) IsStatusError() bool

type ReInterpretedError

type ReInterpretedError struct {
	Client      string `json:"client"`
	Context     string `json:"context,omitempty"`
	Domain      string `json:"domain,omitempty"`
	Reason      string `json:"reason,omitempty"`
	Key         string `json:"key,omitempty"`
	Value       string `json:"value,omitempty"`
	Description string `json:"description,omitempty"`
}

ReInterpretedError represents an error added in locally

Jump to

Keyboard shortcuts

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