Skip to content

Improve bad request response messages(GONRG-3718)

Rustam Lotsmanenko (EPAM) requested to merge improve-response-messages into master

Description:

In case when elasticsearch is acknowledging a request as a "bad request", we will look to suppressed exception and if there will be a response body with the fail reason we will transfer it to the user.
Issue:#70 (closed)

How to test:

Perform queries that do not fit existing index mapping at elasticsearch.
Query:

{
    "kind": "{{data-partition-id}}:wks:master-data--Well:*.*.*",
    "query": "nested(data.NameAliases, (AliasName:\"L10-14\" AND AliasNameTypeID:\"osdu:reference-data--AliasNameType:WELL_NAME:\"))"
}

Mapping:

"NameAliases": {
   "type": "flattened"
},

Response:

{
    "code": 400,
    "reason": "Bad Request",
    "message": "failed to create query: [nested] failed to find nested object under path [data.NameAliases]"
}

Changes include:

  • Refactor (a non-breaking change that improves code maintainability).
  • Bugfix (a non-breaking change that solves an issue).
  • New feature (a non-breaking change that adds functionality).
  • Breaking change (a change that is not backward-compatible and/or changes current functionality).

Changes in:

  • GCP
  • Azure
  • AWS
  • IBM

Dev Checklist:

  • Added Unit Tests, wherever applicable.
  • Updated the Readme, if applicable.
  • Existing Tests pass
  • Verified functionality locally
  • Self Reviewed my code for formatting and complex business logic.
Edited by Rustam Lotsmanenko (EPAM)

Merge request reports