implement failer for device response

Ensures that errors are returned in a structured JSON format.
This commit is contained in:
groob
2017-12-10 10:11:55 -05:00
parent 1d8f75e290
commit 6dbbd930fd

View File

@@ -46,6 +46,8 @@ type getDevicesResponse struct {
Err error `json:"err,omitempty"`
}
func (r getDevicesResponse) Failed() error { return r.Err }
func decodeListDevicesRequest(ctx context.Context, r *http.Request) (interface{}, error) {
defer r.Body.Close()
var opts ListDevicesOption