forked from Cliffbreak/tsviewer
22 lines
475 B
Go
22 lines
475 B
Go
|
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
|
||
|
func NewError(status int, err error) *Response {
|
||
|
return &Response{
|
||
|
Content: Error{
|
||
|
Status: status,
|
||
|
Error: err.Error(),
|
||
|
Timestamp: time.Now().Format("2006-01-02T15:04:05Z"), //.Format("02 Jan 2006, 15:04:05 MST"),
|
||
|
},
|
||
|
}
|
||
|
}
|