Skip to content

Daemon returns different formats of error message #1808

Closed
@Nick-S-2018

Description

@Nick-S-2018

In some cases, daemon can return different formats of error message for the same operation. The returned format depends on a specific error. E.g., here are two responses for the insert request when daemon is used without Buddy:

curl -X POST localhost:9308/sql?mode=raw -d "query=create table test(f text)"
[{"total":0,"error":"","warning":""}]

curl -sX POST http://localhost:9308/insert  -d '{
  "index":"test",
  "id":1,
  "doc":
  {
    "f" : "a"               
  }
}'
{"_index":"test","_id":1,"created":true,"result":"created","status":201}

curl -sX POST http://localhost:9408/insert  -d '{
  "index":"test",
  "id":1,
  "doc":
  {
    "f" : "a"
  }
}'
{"error":{"type":"duplicate id '1'","index":"test"},"status":409}

curl -sX POST http://localhost:9408/insert  -d '{
  "index":"test",
  "id":-1,
  "doc":
  {
    "f" : "a"
  }
}'
{"error":"Negative document ids are not allowed"}

This can lead to problems with our OpenAPI-generated clients, so we should think of unifying those response formats in some way.

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions