Documentation
¶
Index ¶
- Constants
- func Annotate(cause error, annotations ...Annotation) error
- func Decode(r io.Reader) (err error)
- func Encode(w io.Writer, in error) error
- func Flatten(err error) error
- func NewAborted(message string, detail ErrorInfo) (err error)
- func NewAlreadyExists(message string, detail ResourceInfo) (err error)
- func NewBadRequest(message string, detail BadRequest) error
- func NewCancelled(message string) (err error)
- func NewDataLoss(message string, detail DebugInfo) (err error)
- func NewDeadlineExceeded(message string, detail DebugInfo) (err error)
- func NewFailedPrecondition(message string, detail PreconditionFailure) error
- func NewInternal(message string, detail DebugInfo) (err error)
- func NewNotFound(message string, detail ResourceInfo) error
- func NewOutOfRange(message string, detail BadRequest) (err error)
- func NewPermissionDenied(message string, detail ErrorInfo) (err error)
- func NewResourceExhausted(message string, detail QuotaFailure) (err error)
- func NewUnauthenticated(message string, detail ErrorInfo) (err error)
- func NewUnavailable(message string, detail DebugInfo) (err error)
- func NewUnimplemented(message string) (err error)
- func NewUnknown(message string, detail DebugInfo) (err error)
- func Register(typeUrl string, provider func() Any)
- type Annotation
- type Any
- type AnyDetail
- type BadRequest
- type DebugInfo
- type ErrorInfo
- type FieldViolation
- type Help
- type HttpStatusCode
- type Link
- type LocalizedMessage
- type Message
- type Modifier
- type PreconditionFailure
- type QuotaFailure
- type RequestInfo
- type ResourceInfo
- type RoundTripper
- type StackTrace
- type StatusCode
- type StatusCodeName
- 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, detail ResourceInfo) (err error)
func NewBadRequest ¶
func NewBadRequest(message string, detail BadRequest) error
func NewCancelled ¶
func NewDataLoss ¶
func NewDeadlineExceeded ¶
func NewFailedPrecondition ¶
func NewFailedPrecondition(message string, detail PreconditionFailure) error
func NewInternal ¶
func NewNotFound ¶
func NewNotFound(message string, detail ResourceInfo) error
func NewOutOfRange ¶
func NewOutOfRange(message string, detail BadRequest) (err error)
func NewPermissionDenied ¶
func NewResourceExhausted ¶
func NewResourceExhausted(message string, detail QuotaFailure) (err error)
func NewUnauthenticated ¶
func NewUnavailable ¶
func NewUnimplemented ¶
func NewUnknown ¶
Types ¶
type Annotation ¶
type Annotation interface {
Annotate(m Modifier)
}
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) 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 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 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) MarshalJSON ¶
func (d LocalizedMessage) MarshalJSON() ([]byte, error)
func (LocalizedMessage) TypeUrl ¶
func (d LocalizedMessage) TypeUrl() string
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) 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) 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) 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) 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 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 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 ¶
Click to show internal directories.
Click to hide internal directories.