Documentation ¶
Index ¶
- func IsError(err error) bool
- func ServerBadRouteError(msg string, method, url string) error
- func ServerEnsurePanicResponses(ctx context.Context, resp http.ResponseWriter, log logr.Logger)
- func ServerHTTPStatusFromErrorType(err error) int
- func ServerInvalidRequestError(argument string, validationMsg string, method, url string) error
- func ServerWriteError(ctx context.Context, resp http.ResponseWriter, err error, log logr.Logger)
- type AbortedErrorType
- type AlreadyExistsErrorType
- type BadRouteErrorType
- type CanceledErrorType
- type DataLossErrorType
- type DeadlineExceededErrorType
- type Error
- func ErrorAborted() Error
- func ErrorAlreadyExists() Error
- func ErrorBadRoute(msg string) Error
- func ErrorCanceled() Error
- func ErrorDataLoss() Error
- func ErrorDeadlineExeeded() Error
- func ErrorFailedPrecondition() Error
- func ErrorInternal(msg string) Error
- func ErrorInternalWith(err error, msg string) Error
- func ErrorInvalidArgument(argument string, validationMsg string) Error
- func ErrorMalformed(msg string) Error
- func ErrorNotFound() Error
- func ErrorOutOfRange() Error
- func ErrorPermissionDenied() Error
- func ErrorRequiredArgument(argument string) Error
- func ErrorResourceExhausted() Error
- func ErrorUnauthenticated() Error
- func ErrorUnavailable() Error
- func ErrorUnimplemented() Error
- func ErrorUnknown() Error
- func NewError(err error, msg string) Error
- type FailedPreconditionErrorType
- type InternalErrorType
- type InvalidArgumentErrorType
- type MalformedErrorType
- type NotFoundErrorType
- type OutOfRangeErrorType
- type PermissionDeniedErrorType
- type ResourceExhaustedErrorType
- type Server
- type UnauthenticatedErrorType
- type UnavailableErrorType
- type UnimplementedErrorType
- type UnknownErrorType
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ServerBadRouteError ¶
ServerBadRouteError is used when the blaze server cannot route a request
func ServerEnsurePanicResponses ¶
ServerEnsurePanicResponses esure panic responses
func ServerHTTPStatusFromErrorType ¶
ServerHTTPStatusFromErrorType maps a blaze error type into a similar HTTP response status. It is used by the blaze server handler to set the HTTP response status code. Returns 0 if the error is not a blaze error.
func ServerInvalidRequestError ¶
ServerInvalidRequestError is used when the server is called with an invalid argument
func ServerWriteError ¶
ServerWriteError writes Blaze errors in the response and triggers hooks.
Types ¶
type AbortedErrorType ¶
type AbortedErrorType struct{}
AbortedErrorType indicates the operation was aborted, typically due to a concurrency issue like sequencer check failures, transaction aborts, etc.
func (*AbortedErrorType) Error ¶
func (e *AbortedErrorType) Error() string
type AlreadyExistsErrorType ¶
type AlreadyExistsErrorType struct{}
AlreadyExistsErrorType means an attempt to create an entity failed because one already exists
func (*AlreadyExistsErrorType) Error ¶
func (e *AlreadyExistsErrorType) Error() string
type BadRouteErrorType ¶
type BadRouteErrorType struct{}
BadRouteErrorType means that the requested URL path wasn't routable to a blaze service and method. This is returned by the generated server, and usually shouldn't be returned by applications. Instead, applications should use NotFound or Unimplemented.
func (*BadRouteErrorType) Error ¶
func (e *BadRouteErrorType) Error() string
type CanceledErrorType ¶
type CanceledErrorType struct{}
CanceledErrorType indicates the operation was cancelled (typically by the caller).
func (*CanceledErrorType) Error ¶
func (e *CanceledErrorType) Error() string
type DataLossErrorType ¶
type DataLossErrorType struct{}
DataLossErrorType indicates unrecoverable data loss or corruption.
func (*DataLossErrorType) Error ¶
func (e *DataLossErrorType) Error() string
type DeadlineExceededErrorType ¶
type DeadlineExceededErrorType struct{}
DeadlineExceededErrorType means operation expired before completion. For operations that change the state of the system, this error may be returned even if the operation has completed successfully (timeout).
func (*DeadlineExceededErrorType) Error ¶
func (e *DeadlineExceededErrorType) Error() string
type Error ¶
type Error interface { // Type returns the type of the error Type() string // Msg returns a human-readable, unstructured messages describing the error. Msg() string // WithMeta returns a copy of the Error with the given key-value pair attached // as metadata. If the key is already set, it is overwritten. WithMeta(key string, val string) Error // Meta returns the stored value for the given key. If the key has no set // value, Meta returns an empty string. There is no way to distinguish between // an unset value and an explicit empty string. Meta(key string) string // MetaMap returns a copy of the complete key-value metadata map stored on the error. MetaMap() map[string]string // Error returns a string of the form "blaze error <Type>: <Msg>" Error() string //Unwrap returns the wrapped error Unwrap() error }
Error represents an error in a Blaze service call.
func ErrorAlreadyExists ¶
func ErrorAlreadyExists() Error
ErrorAlreadyExists constructs a already exists error
func ErrorDeadlineExeeded ¶
func ErrorDeadlineExeeded() Error
ErrorDeadlineExeeded constructs a canceled error
func ErrorFailedPrecondition ¶
func ErrorFailedPrecondition() Error
ErrorFailedPrecondition constructs a failed precondition error
func ErrorInternal ¶
ErrorInternal When some invariants expected by the underlying system have been broken. In other words, something bad happened in the library or backend service. Do not confuse with HTTP Internal Server Error; an Internal error could also happen on the client code, i.e. when parsing a server response.
func ErrorInternalWith ¶
ErrorInternalWith When some invariants expected by the underlying system have been broken. In other words, something bad happened in the library or backend service. Do not confuse with HTTP Internal Server Error; an Internal error could also happen on the client code, i.e. when parsing a server response. Wraps an other error for more information
func ErrorInvalidArgument ¶
ErrorInvalidArgument constructs invalid argument error
func ErrorMalformed ¶
ErrorMalformed constructs a malformed error
func ErrorPermissionDenied ¶
func ErrorPermissionDenied() Error
ErrorPermissionDenied constructs a already exists error
func ErrorRequiredArgument ¶
ErrorRequiredArgument is a more specific constructor for ErrorInvalidArgument. Should be used when the argument is required (expected to have a non-zero value).
func ErrorResourceExhausted ¶
func ErrorResourceExhausted() Error
ErrorResourceExhausted constructs a resource exhousted error
func ErrorUnauthenticated ¶
func ErrorUnauthenticated() Error
ErrorUnauthenticated constructs a unauthenticated error
func ErrorUnavailable ¶
func ErrorUnavailable() Error
ErrorUnavailable constructs an unavailable error
func ErrorUnimplemented ¶
func ErrorUnimplemented() Error
ErrorUnimplemented constructs an unimplemented error
func NewError ¶
NewError is the generic constructor for a blaze.Error. The error must be one of the valid predefined ones in errors.go, otherwise it will be converted to an error {type: Internal, msg: "invalid error type {{code}}"}. If you need to add metadata, use .WithMeta(key, value) method after building the error.
type FailedPreconditionErrorType ¶
type FailedPreconditionErrorType struct{}
FailedPreconditionErrorType indicates operation was rejected because the system is not in a state required for the operation's execution. For example, doing an rmdir operation on a directory that is non-empty, or on a non-directory object, or when having conflicting read-modify-write on the same resource.
func (*FailedPreconditionErrorType) Error ¶
func (e *FailedPreconditionErrorType) Error() string
type InternalErrorType ¶
type InternalErrorType struct {
// contains filtered or unexported fields
}
InternalErrorType error is an error produced by a downstream dependency of blaze
func (*InternalErrorType) Error ¶
func (e *InternalErrorType) Error() string
func (*InternalErrorType) Unwrap ¶
func (e *InternalErrorType) Unwrap() error
Unwrap implements the wrappable error
type InvalidArgumentErrorType ¶
type InvalidArgumentErrorType struct{}
InvalidArgumentErrorType indicates client specified an invalid argument. It indicates arguments that are problematic regardless of the state of the system (i.e. a malformed file name, required argument, number out of range, etc.).
func (*InvalidArgumentErrorType) Error ¶
func (e *InvalidArgumentErrorType) Error() string
type MalformedErrorType ¶
type MalformedErrorType struct{}
MalformedErrorType indicates an error occured while decoding the client's request. This means that the message was encoded improperly, or that there is an disagreement in message format between client and server
func (*MalformedErrorType) Error ¶
func (e *MalformedErrorType) Error() string
type NotFoundErrorType ¶
type NotFoundErrorType struct{}
NotFoundErrorType indicates a common NotFound error
func (*NotFoundErrorType) Error ¶
func (e *NotFoundErrorType) Error() string
type OutOfRangeErrorType ¶
type OutOfRangeErrorType struct{}
OutOfRangeErrorType means operation was attempted past the valid range. For example, seeking or reading past end of a paginated collection.
Unlike InvalidArgument, this error indicates a problem that may be fixed if the system state changes (i.e. adding more items to the collection).
There is a fair bit of overlap between FailedPrecondition and OutOfRange. We recommend using OutOfRange (the more specific error) when it applies so that callers who are iterating through a space can easily look for an OutOfRange error to detect when they are done.
func (*OutOfRangeErrorType) Error ¶
func (e *OutOfRangeErrorType) Error() string
type PermissionDeniedErrorType ¶
type PermissionDeniedErrorType struct{}
PermissionDeniedErrorType indicates the caller does not have permission to execute the specified operation. It must not be used if the caller cannot be identified (Unauthenticated).
func (*PermissionDeniedErrorType) Error ¶
func (e *PermissionDeniedErrorType) Error() string
type ResourceExhaustedErrorType ¶
type ResourceExhaustedErrorType struct{}
ResourceExhaustedErrorType indicates some resource has been exhausted, perhaps a per-user quota, or perhaps the entire file system is out of space.
func (*ResourceExhaustedErrorType) Error ¶
func (e *ResourceExhaustedErrorType) Error() string
type UnauthenticatedErrorType ¶
type UnauthenticatedErrorType struct{}
UnauthenticatedErrorType indicates the request does not have valid authentication credentials for the operation.
func (*UnauthenticatedErrorType) Error ¶
func (e *UnauthenticatedErrorType) Error() string
type UnavailableErrorType ¶
type UnavailableErrorType struct{}
UnavailableErrorType indicates the service is currently unavailable. This is a most likely a transient condition and may be corrected by retrying with a backoff.
func (*UnavailableErrorType) Error ¶
func (e *UnavailableErrorType) Error() string
type UnimplementedErrorType ¶
type UnimplementedErrorType struct{}
UnimplementedErrorType indicates operation is not implemented or not supported/enabled in this service.
func (*UnimplementedErrorType) Error ¶
func (e *UnimplementedErrorType) Error() string
type UnknownErrorType ¶
type UnknownErrorType struct{}
UnknownErrorType For example handling errors raised by APIs that dont return enough error information
func (*UnknownErrorType) Error ¶
func (e *UnknownErrorType) Error() string