Documentation ¶
Overview ¶
Package errors provides definitions for some common errors that may be encountered through the course of the turning mission control's functions. These errors may be eventually mapped to HTTP error codes, when being returned as a response.
Index ¶
Constants ¶
View Source
const ( // Unknown error type is used for all generic errors Unknown = ErrorType(iota) // BadInput is used when any function encounters bad/incomplete input BadInput // BadResponse is used when a go method or an external service returns bad data BadResponse // BadConfig is used when an initialization step fails due to missing / invalid config values BadConfig // NotFound is used when a resource cannot be located NotFound // TimeOut is used when a request / go routine times out TimeOut )
Variables ¶
This section is empty.
Functions ¶
func GetErrorCode ¶
func GetErrorCode(err error, p fiberProtocol.Protocol) int
GetErrorCode maps the ErrorType to http status codes and returns it
Types ¶
type TuringError ¶
TuringError associates an error message with a status code.
func NewTuringError ¶
func NewTuringError(err error, protocol fiberProtocol.Protocol, code ...int) *TuringError
NewTuringError creates an error with a Status code
func (*TuringError) Error ¶
func (e *TuringError) Error() string
Error satisfies the error interface
Click to show internal directories.
Click to hide internal directories.