Skip to content

Fix error handling code in middleware/sendJSON #1108

@orangejulius

Description

@orangejulius

The error handling code in middleware/sendJSON.js has some potential problems:

  • It relies on a module, elasticsearch-exceptions, that is 3 years old and reportedly only supports Elasticsearch 1.4
  • In the case of errors, it sets the default error code to 400. This means that a lot of errors such as failures to connect to other services are reported as 400 instead of 500 errors. 400 errors should be reserved for cases where the user's input, such as query params, are incorrect.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions