Documentation ¶
Index ¶
- Variables
- func AsHandlerError(service, procedure string, err error) error
- func ClientTimeoutError(Service string, Procedure string, Duration time.Duration) error
- func HandlerTimeoutError(Caller string, Service string, Procedure string, Duration time.Duration) error
- func MissingParameters(params []string) error
- func RouterUnrecognizedProcedureError(service, procedure string) error
- type BadRequestError
- type ErrOutboundNotStarted
- type HandlerError
- type ProcedureFailedError
- type RemoteTimeoutError
- type TimeoutError
- type UnexpectedError
- type UnrecognizedProcedureError
- type UnsupportedTypeError
Constants ¶
This section is empty.
Variables ¶
var ErrNoRouter = errors.New("no router configured for transport inbound")
ErrNoRouter indicates that Start was called without first calling SetRouter for an inbound transport.
Functions ¶
func AsHandlerError ¶
AsHandlerError converts an error into a HandlerError, leaving it unchanged if it is already one.
func ClientTimeoutError ¶
ClientTimeoutError constructs an instance of a TimeoutError representing a timeout that occurred while the client was waiting during a request to a remote handler. It includes the service, procedure and duration waited.
func HandlerTimeoutError ¶
func HandlerTimeoutError(Caller string, Service string, Procedure string, Duration time.Duration) error
HandlerTimeoutError constructs an instance of a TimeoutError representing a timeout that occurred during the handler execution, with the caller, service, procedure and duration waited.
func MissingParameters ¶ added in v1.0.0
MissingParameters returns an error representing a failure to process a request because it was missing required parameters.
func RouterUnrecognizedProcedureError ¶ added in v1.8.0
RouterUnrecognizedProcedureError returns an error indicating that the router could find no corresponding handler for the request.
Types ¶
type BadRequestError ¶
type BadRequestError interface { error // contains filtered or unexported methods }
BadRequestError is a failure to process a request because the request was invalid.
func RemoteBadRequestError ¶
func RemoteBadRequestError(message string) BadRequestError
RemoteBadRequestError builds a new BadRequestError with the given message.
It represents a BadRequest failure from a remote service.
type ErrOutboundNotStarted ¶
type ErrOutboundNotStarted string
ErrOutboundNotStarted represents a failure because Start() was not called on an outbound or if Stop() was called.
func (ErrOutboundNotStarted) Error ¶
func (e ErrOutboundNotStarted) Error() string
type HandlerError ¶
type HandlerError interface { error // contains filtered or unexported methods }
HandlerError represents handler errors on the handler side.
The general hierarchy we have is:
BadRequestError HandlerError | | +--------> handlerBadRequestError <------+ | | +--------> remoteBadRequestError | | UnexpectedError | | | +--------> handlerUnexpectedError <------+ | | +--------> remoteUnexpectedError | | TimeoutError | | | +--------> handlerTimeoutError <---------+ | +--------> remoteTimeoutError | +--------> clientTimeoutError
Only the handler versions of the error types are HandlerErrors. If a handler returns one of the remote or client version, they will be wrapped in a new UnexpectedError.
HandlerError represents error types that can be returned from a handler that the Inbound implementation MUST handle. The inbound implementation can then returns the remote version of the error to the user.
Currently, this includes BadRequestError, UnexpectedError and TimeoutError. Error types which know how to convert themselves into BadRequestError, UnexpectedError or TimeoutError may provide a `AsHandlerError() HandlerError` method.
func HandlerBadRequestError ¶
func HandlerBadRequestError(err error) HandlerError
HandlerBadRequestError wraps the given error into a BadRequestError.
It represents a local failure while processing an invalid request.
func HandlerUnexpectedError ¶
func HandlerUnexpectedError(err error) HandlerError
HandlerUnexpectedError wraps the given error into an UnexpectedError.
It represens a local failure while processing a request.
type ProcedureFailedError ¶
ProcedureFailedError is a failure to execute a procedure due to an unexpected error.
func (ProcedureFailedError) AsHandlerError ¶
func (e ProcedureFailedError) AsHandlerError() HandlerError
AsHandlerError for ProcedureFailedError.
func (ProcedureFailedError) Error ¶
func (e ProcedureFailedError) Error() string
type RemoteTimeoutError ¶
type RemoteTimeoutError string
RemoteTimeoutError represents a TimeoutError from a remote handler.
func (RemoteTimeoutError) Error ¶
func (e RemoteTimeoutError) Error() string
type TimeoutError ¶
type TimeoutError interface { error // contains filtered or unexported methods }
TimeoutError indicates that an error occurred due to a context deadline over the course of a request over any transport.
type UnexpectedError ¶
type UnexpectedError interface { error // contains filtered or unexported methods }
UnexpectedError is a server failure due to unhandled errors. This can be caused if the remote server panics while processing the request or fails to handle any other errors.
func RemoteUnexpectedError ¶
func RemoteUnexpectedError(message string) UnexpectedError
RemoteUnexpectedError builds a new UnexpectedError with the given message.
It represents an UnexpectedError from a remote service.
type UnrecognizedProcedureError ¶
type UnrecognizedProcedureError interface { error // contains filtered or unexported methods }
UnrecognizedProcedureError indicates that a request could not be handled locally because the router contained no handler for the request.
type UnsupportedTypeError ¶ added in v0.4.0
UnsupportedTypeError is a failure to process a request because the RPC type is unknown to the transport
func (UnsupportedTypeError) Error ¶ added in v0.4.0
func (e UnsupportedTypeError) Error() string