Making it json'able
@@ -4,8 +4,8 @@ package errors
// When creating errors you should provide a code (could be and http status code)
// and a message, this way we can handle the errors in a centralized place.
type Error struct {
- Code int
- message string
+ Code int `json:"-"`
+ Message string `json:"error"`
}
// New creates a new instance of Error
@@ -14,5 +14,5 @@ func New(code int, message string) *Error {
}
func (e Error) Error() string {
- return e.message
+ return e.Message
}
