mirror of https://github.com/certusone/santa.git
20 lines
280 B
Go
20 lines
280 B
Go
|
package utils
|
||
|
|
||
|
import "encoding/json"
|
||
|
|
||
|
type restError struct {
|
||
|
Error string `json:"error"`
|
||
|
}
|
||
|
|
||
|
func newError(err error) restError {
|
||
|
return restError{err.Error()}
|
||
|
}
|
||
|
|
||
|
func (e restError) marshal() []byte {
|
||
|
out, err := json.Marshal(e)
|
||
|
if err != nil {
|
||
|
panic(err)
|
||
|
}
|
||
|
return out
|
||
|
}
|