Pilosa error response structure differs between endpoints
Description
Index already exists error response has success and error/mesage fields.
$ curl localhost:10101/index/i1 -d ''
{"success":false,"error":{"message":"index already exists"}}
The query error response has only an error field.
$ curl localhost:10101/index/i1/query -d '('
{"error":"parsing: parsing: \nparse error near Unknown (line 1 symbol 1 - line 1 symbol 1):\n\"\"\n"}
We should make JSON error responses uniform.
Success criteria (What criteria will consider this ticket closeable?)
All error responses should have the same structure.
I'm a fan of consistency... obviously we have to keep compatibility in mind. I think we can add fields for consistency as much as possible and mark others as deprecated to be removed or changed in 2.0
In an attempt to sum up what needs to change on the query result JSON:
- add the
successbool field - change the
errorfield to be an object containing amessagefield
Obviously we can't do (2) until v2.0 because it breaks the API. We can do (1) at any time because it's an addition.
Does that all seem correct? Have I missed anything?
The alternative is adding another field (something like status) and deprecating both success and error.