Documentation ¶
Index ¶
Constants ¶
View Source
const ( ErrorCodeOk = 0 ErrorCodeInvalid = 3 // validation failed ErrorCodeNotFound = 5 // entity does not exist ErrorCodeConflict = 6 // action cannot be performed ErrorCodeNotAuthorized = 7 // requester does not have permissions to perform action ErrorCodeResourceExhausted = 8 // the resource has been exhausted ErrorCodeUnimplemented = 12 // the operation has not been implemented ErrorCodeInternal = 13 // internal error ErrorCodeNOTAUTHENTICATED = 16 // requester is not authenticated )
Application error codes
Variables ¶
This section is empty.
Functions ¶
func ErrorMessageFromError ¶
ErrorMessage returns the human-readable message of the error, if available. Otherwise returns a generic error message.
Types ¶
type Error ¶
type Error struct { Code ErrorCode `json:"code"` Message string `json:"message"` Operation string `json:"operation"` Err error `json:"err"` }
func Wrap ¶
Wrap returns a new error that contains the passed error but with a different operation, useful for creating stacktraces
type ErrorCode ¶
type ErrorCode int
func ErrorCodeFromError ¶
ErrorCode returns the code of the root error, if available. Otherwise returns ErrorCodeInternal.
type ErrorInterface ¶
type HttpException ¶
type HttpException interface {
GetCode() int
}
type HttpExceptionBuilder ¶
func (*HttpExceptionBuilder) Error ¶
func (ptr *HttpExceptionBuilder) Error() string
func (*HttpExceptionBuilder) GetCode ¶
func (ptr *HttpExceptionBuilder) GetCode() int
type HttpExceptionBuilderWithError ¶
type HttpExceptionBuilderWithError struct { HttpExceptionBuilder Err error }
func (*HttpExceptionBuilderWithError) Error ¶
func (ptr *HttpExceptionBuilderWithError) Error() string
func (*HttpExceptionBuilderWithError) GetCode ¶
func (ptr *HttpExceptionBuilderWithError) GetCode() int
Click to show internal directories.
Click to hide internal directories.