Documentation ¶
Index ¶
- Constants
- func Clear(code string, context ...string)
- func Cleared() time.Time
- func Count(code string, context ...string) int
- func Get(code string, context ...string) counters
- func IsBadRequest(err error) bool
- func IsBadResponse(err error) bool
- func IsCircuitBroken(err error) bool
- func IsConflict(err error) bool
- func IsForbidden(err error) bool
- func IsInternalServerError(err error) bool
- func IsNotFound(err error) bool
- func IsTimeout(err error) bool
- func IsUnauthorized(err error) bool
- func ToProtobuf(err Error) *pe.PlatformError
- func Track(code string, context ...string)
- type Error
- func BadRequest(code string, errValue interface{}, context ...string) Error
- func BadResponse(code string, errValue interface{}, context ...string) Error
- func CircuitBroken(code string, errValue interface{}, context ...string) Error
- func Conflict(code string, errValue interface{}, context ...string) Error
- func Forbidden(code string, errValue interface{}, context ...string) Error
- func FromProtobuf(err *pe.PlatformError) Error
- func InternalServerError(code string, errValue interface{}, context ...string) Error
- func NotFound(code string, errValue interface{}, context ...string) Error
- func Timeout(code string, errValue interface{}, context ...string) Error
- func Unauthorized(code string, errValue interface{}, context ...string) Error
- type LocalError
- func (self LocalError) AddContext(s ...string) Error
- func (self LocalError) Code() string
- func (self LocalError) Context() []string
- func (self LocalError) Description() string
- func (self LocalError) Error() string
- func (self LocalError) HttpCode() uint32
- func (self LocalError) MultiStack() *stack.Multi
- func (self LocalError) Type() string
Constants ¶
const ( ErrorInternalServer = "INTERNAL_SERVER_ERROR" ErrorBadRequest = "BAD_REQUEST" ErrorForbidden = "FORBIDDEN" ErrorBadResponse = "BAD_RESPONSE" ErrorTimeout = "TIMEOUT" ErrorNotFound = "NOT_FOUND" ErrorConflict = "CONFLICT" ErrorCircuitBroken = "CIRCUIT_BROKEN" )
Variables ¶
This section is empty.
Functions ¶
func IsBadRequest ¶
func IsBadResponse ¶
func IsCircuitBroken ¶
func IsConflict ¶
func IsForbidden ¶
func IsInternalServerError ¶
func IsNotFound ¶
func IsUnauthorized ¶
func ToProtobuf ¶
func ToProtobuf(err Error) *pe.PlatformError
ToProtobuf takes a Error and returns a protobuf error
Types ¶
type Error ¶
type Error interface { Error() string Type() string Code() string Description() string HttpCode() uint32 Context() []string AddContext(...string) Error MultiStack() *stack.Multi }
Error represents our customer error type
func BadRequest ¶
BadRequest error message
func BadResponse ¶
BadResponse error message
func CircuitBroken ¶
func FromProtobuf ¶
func FromProtobuf(err *pe.PlatformError) Error
FromProtobuf takes a protobuf error and returns an Error as above
func InternalServerError ¶
InternalServerError message
func Unauthorized ¶
Unauthorized error code
type LocalError ¶
type LocalError struct {
// contains filtered or unexported fields
}
LocalError is a type of error we build
func (LocalError) AddContext ¶
func (self LocalError) AddContext(s ...string) Error
func (LocalError) Code ¶
func (self LocalError) Code() string
Code returns the error code, e.g. com.hailocab.service.something.went.wrong
func (LocalError) Context ¶
func (self LocalError) Context() []string
Context contains a list of strings with more information about the error
func (LocalError) Description ¶
func (self LocalError) Description() string
Description returns a human readable version of the error
func (LocalError) Error ¶
func (self LocalError) Error() string
Error representation is just the description
func (LocalError) HttpCode ¶
func (self LocalError) HttpCode() uint32
HttpCode returns the HTTP code we should be returning back via the API
func (LocalError) MultiStack ¶
func (self LocalError) MultiStack() *stack.Multi
MultiStack identifies the locations this error was wrapped at.
func (LocalError) Type ¶
func (self LocalError) Type() string
Type returns the type of error message