Documentation
¶
Index ¶
- Constants
- func Annotate(cause error, annotations ...Annotation) error
- func Decode(body io.Reader) (err error)
- func Encode(err error) (data []byte, _err error)
- func Flatten(err error) error
- func NewAborted(message string, info ErrorInfo) (err error)
- func NewAlreadyExists(message string, info ResourceInfo) (err error)
- func NewBadRequest(message string, violations ...FieldViolation) error
- func NewCancelled(message string) (err error)
- func NewDataLoss(message string, info DebugInfo) (err error)
- func NewDeadlineExceeded(message string, info DebugInfo) (err error)
- func NewFailedPrecondition(message string, violations ...TypedViolation) error
- func NewInternal(message string, info DebugInfo) (err error)
- func NewNotFound(message string, detail ResourceInfo) error
- func NewOutOfRange(message string, violations ...FieldViolation) (err error)
- func NewPermissionDenied(message string, info ErrorInfo) (err error)
- func NewResourceExhausted(message string, violations ...Violation) (err error)
- func NewUnauthenticated(message string, info ErrorInfo) (err error)
- func NewUnavailable(message string, info DebugInfo) (err error)
- func NewUnimplemented(message string) (err error)
- func NewUnknown(message string, info DebugInfo) (err error)
- func RegisterType(typeUrl string, provider func() Any)
- type Annotation
- func WithCode(code StatusCode) Annotation
- func WithDetail(details ...Any) Annotation
- func WithHelp(links ...Link) Annotation
- func WithHttpCode(httpCode int) Annotation
- func WithLocalizedMessage(local string, message string) Annotation
- func WithMessage(message string) Annotation
- func WithRequestInfo(requestId, servingData string) Annotation
- func WithStack() Annotation
- type Any
- type AnyDetail
- type BadRequest
- type DebugInfo
- type ErrorInfo
- type FieldViolation
- type Help
- type Link
- type LocalizedMessage
- type PreconditionFailure
- type QuotaFailure
- type RequestInfo
- type ResourceInfo
- type RoundTripper
- type StatusCode
- type TypedViolation
- type Violation
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 NewAborted ¶
func NewAlreadyExists ¶
func NewAlreadyExists(message string, info ResourceInfo) (err error)
func NewBadRequest ¶
func NewBadRequest(message string, violations ...FieldViolation) error
func NewCancelled ¶
func NewDataLoss ¶
func NewDeadlineExceeded ¶
func NewFailedPrecondition ¶
func NewFailedPrecondition(message string, violations ...TypedViolation) error
func NewInternal ¶
func NewNotFound ¶
func NewNotFound(message string, detail ResourceInfo) error
func NewOutOfRange ¶
func NewOutOfRange(message string, violations ...FieldViolation) (err error)
func NewPermissionDenied ¶
func NewResourceExhausted ¶
func NewUnauthenticated ¶
func NewUnavailable ¶
func NewUnimplemented ¶
func NewUnknown ¶
func RegisterType ¶
Types ¶
type Annotation ¶
type Annotation func(err *annotated)
func WithCode ¶
func WithCode(code StatusCode) Annotation
func WithDetail ¶
func WithDetail(details ...Any) Annotation
func WithHelp ¶
func WithHelp(links ...Link) Annotation
func WithHttpCode ¶ added in v0.1.1
func WithHttpCode(httpCode int) Annotation
func WithLocalizedMessage ¶
func WithLocalizedMessage(local string, message string) Annotation
func WithMessage ¶
func WithMessage(message string) Annotation
func WithRequestInfo ¶
func WithRequestInfo(requestId, servingData string) Annotation
func WithStack ¶
func WithStack() Annotation
type BadRequest ¶
type BadRequest struct {
FieldViolations []FieldViolation `json:"fieldViolations,omitempty"`
}
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) MarshalJSON ¶
type ErrorInfo ¶
type ErrorInfo struct {
Reason string `json:"reason,omitempty"`
Domain string `json:"domain,omitempty"`
Metadata map[string]string `json:"metadata,omitempty"`
}
func (ErrorInfo) MarshalJSON ¶
type FieldViolation ¶
type LocalizedMessage ¶
type LocalizedMessage struct {
Local string `json:"local,omitempty"`
Message string `json:"message,omitempty"`
}
func (LocalizedMessage) MarshalJSON ¶
func (d LocalizedMessage) MarshalJSON() ([]byte, error)
func (LocalizedMessage) TypeUrl ¶
func (d LocalizedMessage) TypeUrl() string
type PreconditionFailure ¶
type PreconditionFailure struct {
Violations []TypedViolation `json:"violations,omitempty"`
}
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) 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) 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) 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
}
type StatusCode ¶
type StatusCode int
const ( OK StatusCode = iota Cancelled Unknown InvalidArgument DeadlineExceeded NotFound AlreadyExists PermissionDenied ResourceExhausted FailedPrecondition Aborted OutOfRange Unimplemented Internal DataLoss Unauthenticated )
func Code ¶
func Code(err error) StatusCode
func HttpToCode ¶ added in v0.1.1
func HttpToCode(httpCode int) StatusCode
func StrToCode ¶
func StrToCode(status string) StatusCode
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 TypedViolation ¶
Click to show internal directories.
Click to hide internal directories.