octoblu / meshblu

Meshblu is a cross-protocol IoT machine-to-machine messaging system.
https://meshblu.readme.io/
MIT License
815 stars 182 forks source link

Errors returning as an array, not sure when you might have multiple errors on a single request #8

Closed jsgoecke closed 10 years ago

jsgoecke commented 10 years ago

Right now an error returns an array of errors, like this:

{
   "errors":[
      {
         "message":"Devices not found",
         "code":404
      }
   ],
   "timestamp":1390249917866,
   "eventCode":403,
   "_id":"52dd87bd6510d36bc4000003"
}

As it is not clear when multiple errors might occur or how to handle them, it might be better to return a single object rather than an array.

chrismatthieu commented 10 years ago

Thanks for opening this ticket. I've confirmed that all error responses are only returning 1 error so I removed the array context and changed the first element to error:

{ "error": { "message":"Devices not found", "code":404 }, "timestamp":1390249917866, "eventCode":403, "_id":"52dd87bd6510d36bc4000003" }