Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GetHTTPCode ¶
GetHTTPCode returns an HTTP status code that corresponds to the ErrorType.
func New ¶
func New(args ...interface{}) error
New builds an error value from its arguments. The type of each argument determines its meaning. If more than one argument of a given type is presented, only the last one is recorded.
The types are:
string Treated as an error message and assigned to the Err field after a call to errors.New errs.ErrorType The class of error, such as not found error The underlying error that triggered this one
If the error is printed, only those items that have been set to non-zero values will appear in the result
If Type is not specified or Other, we set it to the Type of the underlying error
Types ¶
type ErrorType ¶
type ErrorType uint8
ErrorType defines the type of the error.
const ( Other ErrorType = iota // Unclassified error NotFound // Item does not exist BadRequest // A remote REST call returned HTTP 400 )
Types of errors.
The values of the error types are common for the whole app. Do not reorder this list or remove any items since that will change their values. New items must be added only to the end