go-tsviewer/response/error.go

20 lines
443 B
Go
Raw Normal View History

2019-01-14 20:07:11 +00:00
package response
import "time"
// Error data type
type Error struct {
Status int `json:"status"`
Error string `json:"error"`
Timestamp string `json:"timestamp"`
}
// NewError creates a new Response fill with an error
2019-01-17 00:35:51 +00:00
func NewError(status int, err error) *Error {
return &Error{
Status: status,
Error: err.Error(),
Timestamp: time.Now().Format("2006-01-02T15:04:05Z"), //.Format("02 Jan 2006, 15:04:05 MST"),
2019-01-14 20:07:11 +00:00
}
}