errors

package
v1.0.0-rc1 Latest Latest
Warning

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

Go to latest
Published: Nov 23, 2016 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AsHandlerError

func AsHandlerError(service, procedure string, err error) error

AsHandlerError converts an error into a HandlerError, leaving it unchanged if it is already one.

func ClientTimeoutError

func ClientTimeoutError(Service string, Procedure string, Duration time.Duration) error

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 MultiError added in v0.5.0

func MultiError(errors []error) error

MultiError combines a list of errors into one. The list MUST NOT contain nil.

Returns nil if the error list is empty.

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 ErrorGroup added in v0.5.0

type ErrorGroup []error

ErrorGroup represents a collection of errors.

func (ErrorGroup) Error added in v0.5.0

func (e ErrorGroup) 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

type ProcedureFailedError struct {
	Service   string
	Procedure string
	Reason    error
}

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 struct {
	Service   string
	Procedure string
}

UnrecognizedProcedureError is a failure to process a request because the procedure and/or service name was unrecognized.

func (UnrecognizedProcedureError) AsHandlerError

func (e UnrecognizedProcedureError) AsHandlerError() HandlerError

AsHandlerError for UnrecognizedProcedureError.

func (UnrecognizedProcedureError) Error

type UnsupportedTypeError added in v0.4.0

type UnsupportedTypeError struct {
	Transport string
	Type      string
}

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

Jump to

Keyboard shortcuts

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