featurebase icon indicating copy to clipboard operation
featurebase copied to clipboard

Pilosa error response structure differs between endpoints

Open yuce opened this issue 6 years ago • 3 comments

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.

yuce avatar Dec 27 '18 21:12 yuce

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

jaffee avatar Dec 31 '18 23:12 jaffee

In an attempt to sum up what needs to change on the query result JSON:

  1. add the success bool field
  2. change the error field to be an object containing a message field

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?

travisturner avatar Jan 14 '19 23:01 travisturner

The alternative is adding another field (something like status) and deprecating both success and error.

yuce avatar Jan 16 '19 14:01 yuce