Add a type for a search error response
See original GitHub issueThe Elasticsearch client needs a type representing an ES error.
It would be amazing to also have a type guard isElasticseachError
, that accepts either a SearchResponse
or a ErrorResponse
and returns true if it’s an error.
A standard response looks like this:
{
"error" : {
"root_cause" : [
{
"type" : "parsing_exception",
"reason" : "Unknown order direction [xxx]",
"line" : 7,
"col" : 16
}
],
"type" : "x_content_parse_exception",
"reason" : "[7:16] [terms] failed to parse field [order]",
"caused_by" : {
"type" : "parsing_exception",
"reason" : "Unknown order direction [xxx]",
"line" : 7,
"col" : 16
}
},
"status" : 400
}
It can be generated by running the following command in DevTools:
GET kibana_sample_data_logs/_search
{
"aggs": {
"2": {
"terms": {
"field": "machine.os.keyword",
"order": {
"1": "xxx"
}
}
}
}
}
Issue Analytics
- State:
- Created 3 years ago
- Comments:5 (2 by maintainers)
Top Results From Across the Web
Standard Error Responses | Search Ads 360 API
This document identifies some of the error codes and messages that Google APIs return. Specifically, the errors listed here are in the global,...
Read more ><input type="search"> - HTML: HyperText Markup Language
It should be a word or short phrase that demonstrates the expected type of data, rather than an explanatory message. The text must...
Read more >Error handling in a Javascript search function - Stack Overflow
I.e. I'd like to display another div with a message when the search comes up with no result and/or when the user makes...
Read more >Handling operation errors - Apollo GraphQL Docs
Apollo Client helps you handle these errors according to their type, enabling you to show appropriate information to the user when an error...
Read more >Improving TypeScript error handling with exhaustive type ...
Discover an improved method for handling errors in TypeScript that solves problems that arise from returning null and throwing try...catch.
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
I’m fine with closing it and \ or waiting until the new client provides types 🤷♀️
Correct.
Also correct.
I’m not sure how this could be solved nicely.