-
Notifications
You must be signed in to change notification settings - Fork 10
/
errors.go
24 lines (18 loc) · 818 Bytes
/
errors.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
// Copyright 2014 Codehack http://codehack.com
// Use of this source code is governed by a MIT-style
// license that can be found in the LICENSE file.
package relax
// StatusError is an error with a HTTP Status code. It allows errors to be
// complete and uniform.
type StatusError struct {
// Code is meant for a HTTP status code or any other numeric ID.
Code int `json:"code"`
// Message is the default error message used in logs.
Message string `json:"message"`
// Details can be any data structure that gives more information about the
// error.
Details interface{} `json:"details,omitempty"`
}
// StatusError implements the error interface.
func (e *StatusError) Error() string { return e.Message }
// BUG(TODO): StatusError is too shallow, need to implement better error system with locale support.