errors

package module
v0.1.3 Latest Latest
Warning

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

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

Documentation

Index

Constants

View Source
const (
	TypeUrlDebugInfo           = typeUrlPrefix + "DebugInfo"
	TypeUrlResourceInfo        = typeUrlPrefix + "ResourceInfo"
	TypeUrlBadRequest          = typeUrlPrefix + "BadRequest"
	TypeUrlPreconditionFailure = typeUrlPrefix + "PreconditionFailure"
	TypeUrlErrorInfo           = typeUrlPrefix + "ErrorInfo"
	TypeUrlQuotaFailure        = typeUrlPrefix + "QuotaFailure"
	TypeUrlRequestInfo         = typeUrlPrefix + "RequestInfo"
	TypeUrlHelp                = typeUrlPrefix + "Help"
	TypeUrlLocalizedMessage    = typeUrlPrefix + "LocalizedMessage"
)

Variables

This section is empty.

Functions

func Annotate

func Annotate(cause error, annotations ...Annotation) error

func Decode

func Decode(r io.Reader) (err error)

func Encode

func Encode(w io.Writer, in error) error

func Flatten

func Flatten(err error) error

func NewAborted

func NewAborted(message string, detail ErrorInfo) (err error)

func NewAlreadyExists

func NewAlreadyExists(message string, detail ResourceInfo) (err error)

func NewBadRequest

func NewBadRequest(message string, detail BadRequest) error

func NewCancelled

func NewCancelled(message string) (err error)

func NewDataLoss

func NewDataLoss(message string, detail DebugInfo) (err error)

func NewDeadlineExceeded

func NewDeadlineExceeded(message string, detail DebugInfo) (err error)

func NewFailedPrecondition

func NewFailedPrecondition(message string, detail PreconditionFailure) error

func NewInternal

func NewInternal(message string, detail DebugInfo) (err error)

func NewNotFound

func NewNotFound(message string, detail ResourceInfo) error

func NewOutOfRange

func NewOutOfRange(message string, detail BadRequest) (err error)

func NewPermissionDenied

func NewPermissionDenied(message string, detail ErrorInfo) (err error)

func NewResourceExhausted

func NewResourceExhausted(message string, detail QuotaFailure) (err error)

func NewUnauthenticated

func NewUnauthenticated(message string, detail ErrorInfo) (err error)

func NewUnavailable

func NewUnavailable(message string, detail DebugInfo) (err error)

func NewUnimplemented

func NewUnimplemented(message string) (err error)

func NewUnknown

func NewUnknown(message string, detail DebugInfo) (err error)

func Register added in v0.1.3

func Register(typeUrl string, provider func() Any)

Types

type Annotation

type Annotation interface {
	Annotate(m Modifier)
}

type Any

type Any interface {
	TypeUrl() string
}

func Details

func Details(err error) (out []Any)

type AnyDetail

type AnyDetail map[string]interface{}

func (AnyDetail) MarshalJSON

func (d AnyDetail) MarshalJSON() ([]byte, error)

func (AnyDetail) TypeUrl

func (d AnyDetail) TypeUrl() string

type BadRequest

type BadRequest struct {
	FieldViolations []FieldViolation `json:"fieldViolations,omitempty"`
}

func (BadRequest) Annotate added in v0.1.3

func (d BadRequest) Annotate(m Modifier)

func (BadRequest) Format

func (d BadRequest) Format(f fmt.State, verb rune)

func (BadRequest) MarshalJSON

func (d BadRequest) MarshalJSON() ([]byte, error)

func (BadRequest) TypeUrl

func (d BadRequest) TypeUrl() string

type DebugInfo

type DebugInfo struct {
	StackEntries []string `json:"stackEntries,omitempty"`
	Detail       string   `json:"detail,omitempty"`
}

func (DebugInfo) Annotate added in v0.1.3

func (d DebugInfo) Annotate(m Modifier)

func (DebugInfo) Format

func (d DebugInfo) Format(f fmt.State, verb rune)

func (DebugInfo) MarshalJSON

func (d DebugInfo) MarshalJSON() ([]byte, error)

func (DebugInfo) TypeUrl

func (d DebugInfo) TypeUrl() string

type ErrorInfo

type ErrorInfo struct {
	Reason   string            `json:"reason,omitempty"`
	Domain   string            `json:"domain,omitempty"`
	Metadata map[string]string `json:"metadata,omitempty"`
}

func (ErrorInfo) Annotate added in v0.1.3

func (d ErrorInfo) Annotate(m Modifier)

func (ErrorInfo) Format

func (d ErrorInfo) Format(f fmt.State, verb rune)

func (ErrorInfo) MarshalJSON

func (d ErrorInfo) MarshalJSON() ([]byte, error)

func (ErrorInfo) TypeUrl

func (d ErrorInfo) TypeUrl() string

type FieldViolation

type FieldViolation struct {
	Field       string `json:"field,omitempty"`
	Description string `json:"description,omitempty"`
}

type Help

type Help struct {
	Links []Link `json:"links,omitempty"`
}

func (Help) Annotate added in v0.1.3

func (d Help) Annotate(m Modifier)

func (Help) Format

func (d Help) Format(f fmt.State, verb rune)

func (Help) MarshalJSON

func (d Help) MarshalJSON() ([]byte, error)

func (Help) TypeUrl

func (d Help) TypeUrl() string

type HttpStatusCode added in v0.1.3

type HttpStatusCode int

func (HttpStatusCode) Annotate added in v0.1.3

func (c HttpStatusCode) Annotate(m Modifier)

func (HttpStatusCode) StatusCode added in v0.1.3

func (c HttpStatusCode) StatusCode() StatusCode
type Link struct {
	Description string `json:"description,omitempty"`
	Url         string `json:"url,omitempty"`
}

type LocalizedMessage

type LocalizedMessage struct {
	Local   string `json:"local,omitempty"`
	Message string `json:"message,omitempty"`
}

func (LocalizedMessage) Annotate added in v0.1.3

func (d LocalizedMessage) Annotate(m Modifier)

func (LocalizedMessage) Format

func (d LocalizedMessage) Format(f fmt.State, verb rune)

func (LocalizedMessage) MarshalJSON

func (d LocalizedMessage) MarshalJSON() ([]byte, error)

func (LocalizedMessage) TypeUrl

func (d LocalizedMessage) TypeUrl() string

type Message added in v0.1.3

type Message string

func (Message) Annotate added in v0.1.3

func (a Message) Annotate(m Modifier)

type Modifier added in v0.1.3

type Modifier interface {
	SetCode(code StatusCode)
	AppendMessage(msg string)
	AppendDetails(details ...Any)
}

type PreconditionFailure

type PreconditionFailure struct {
	Violations []TypedViolation `json:"violations,omitempty"`
}

func (PreconditionFailure) Annotate added in v0.1.3

func (d PreconditionFailure) Annotate(m Modifier)

func (PreconditionFailure) Format

func (d PreconditionFailure) Format(f fmt.State, verb rune)

func (PreconditionFailure) MarshalJSON

func (d PreconditionFailure) MarshalJSON() ([]byte, error)

func (PreconditionFailure) TypeUrl

func (d PreconditionFailure) TypeUrl() string

type QuotaFailure

type QuotaFailure struct {
	Violations []Violation `json:"violations,omitempty"`
}

func (QuotaFailure) Annotate added in v0.1.3

func (d QuotaFailure) Annotate(m Modifier)

func (QuotaFailure) Format

func (d QuotaFailure) Format(f fmt.State, verb rune)

func (QuotaFailure) MarshalJSON

func (d QuotaFailure) MarshalJSON() ([]byte, error)

func (QuotaFailure) TypeUrl

func (d QuotaFailure) TypeUrl() string

type RequestInfo

type RequestInfo struct {
	RequestId   string `json:"requestId,omitempty"`
	ServingData string `json:"servingData,omitempty"`
}

func (RequestInfo) Annotate added in v0.1.3

func (d RequestInfo) Annotate(m Modifier)

func (RequestInfo) Format

func (d RequestInfo) Format(f fmt.State, verb rune)

func (RequestInfo) MarshalJSON

func (d RequestInfo) MarshalJSON() ([]byte, error)

func (RequestInfo) TypeUrl

func (d RequestInfo) TypeUrl() string

type ResourceInfo

type ResourceInfo struct {
	ResourceType string `json:"resourceType,omitempty"`
	ResourceName string `json:"resourceName,omitempty"`
	Owner        string `json:"owner,omitempty"`
	Description  string `json:"description,omitempty"`
}

func (ResourceInfo) Annotate added in v0.1.3

func (d ResourceInfo) Annotate(m Modifier)

func (ResourceInfo) Format

func (d ResourceInfo) Format(f fmt.State, verb rune)

func (ResourceInfo) MarshalJSON

func (d ResourceInfo) MarshalJSON() ([]byte, error)

func (ResourceInfo) TypeUrl

func (d ResourceInfo) TypeUrl() string

type RoundTripper added in v0.1.1

type RoundTripper struct {
	Parent http.RoundTripper
}

func (*RoundTripper) RoundTrip added in v0.1.1

func (e *RoundTripper) RoundTrip(req *http.Request) (resp *http.Response, err error)

type StackTrace added in v0.1.3

type StackTrace string

func (StackTrace) Annotate added in v0.1.3

func (s StackTrace) Annotate(m Modifier)

type StatusCode

type StatusCode int
const (
	OK StatusCode = iota
	Cancelled
	Unknown
	InvalidArgument
	DeadlineExceeded
	NotFound
	AlreadyExists
	PermissionDenied
	ResourceExhausted
	FailedPrecondition
	Aborted
	OutOfRange
	Unimplemented
	Internal
	Unavailable
	DataLoss
	Unauthenticated
)

func Code

func Code(err error) StatusCode

func (StatusCode) Annotate added in v0.1.3

func (c StatusCode) Annotate(m Modifier)

func (StatusCode) Error

func (c StatusCode) Error() string

func (StatusCode) HttpCode

func (c StatusCode) HttpCode() int

func (StatusCode) String

func (c StatusCode) String() string

func (StatusCode) Valid

func (c StatusCode) Valid() bool

type StatusCodeName added in v0.1.3

type StatusCodeName string

func (StatusCodeName) StatusCode added in v0.1.3

func (s StatusCodeName) StatusCode() StatusCode

type TypedViolation

type TypedViolation struct {
	Type        string `json:"type,omitempty"`
	Subject     string `json:"subject,omitempty"`
	Description string `json:"description,omitempty"`
}

type Violation

type Violation struct {
	Subject     string `json:"subject,omitempty"`
	Description string `json:"description,omitempty"`
}

Jump to

Keyboard shortcuts

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