(statusCode int, method, path, format string, args ...interface{})
| 17 | } |
| 18 | |
| 19 | func newError(statusCode int, method, path, format string, args ...interface{}) Error { |
| 20 | msg := format |
| 21 | if len(args) > 0 { |
| 22 | // why we check for that? If the original error message came from our database |
| 23 | // and it contains fmt-reserved words |
| 24 | // like %s or %d we will get MISSING(=...) in our error message and we don't want that. |
| 25 | msg = fmt.Sprintf(msg, args...) |
| 26 | } |
| 27 | |
| 28 | if msg == "" { |
| 29 | msg = iris.StatusText(statusCode) |
| 30 | } |
| 31 | |
| 32 | return Error{ |
| 33 | StatusCode: statusCode, |
| 34 | Method: method, |
| 35 | Path: path, |
| 36 | Message: msg, |
| 37 | Timestamp: time.Now().Unix(), |
| 38 | } |
| 39 | } |
| 40 | |
| 41 | // Error implements the internal Go error interface. |
| 42 | func (e Error) Error() string { |
no test coverage detected
searching dependent graphs…