-
Notifications
You must be signed in to change notification settings - Fork 8.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Search Sessions] Improve search session errors #88613
Conversation
Fix bfetch error (was recognized as unknown error) Make sure handleSearchError always returns an error object.
Pinging @elastic/kibana-app-services (Team:AppServices) |
Adjusted bsearch response format Added verification of error's root cause
@elasticmachine merge upstream |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Overall, LGTM. Left a couple of comments below.
try { | ||
await esClient.asCurrentUser.asyncSearch.delete({ id }); | ||
} catch (e) { | ||
throw getKbnServerError(e); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is it worth updating the other search strategies, or at least letting them know that this is the preferred way to handle errors?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
in general LGTM. great effort and love all tests!
Some feedback:
-
Noticed one empty fail that seems to be not used:
src/plugins/data/common/search/test_data/illegal_state_exception.json
-
It seems that
any
usage grew up? I would really like it if we could avoid that. For example, I think, thattoKibanaServerError
should handleunknown
and do all needed runtime checks inside -
Since this affects all data plugin consumers and errors are something that is often skipped in automated tests, do you think it makes sense to ask some of the plugin consumers teams to test this also in their apps? Maybe someone implicitly relies somewhere on older error formats.
@@ -24,7 +24,7 @@ export enum TimeoutErrorMode { | |||
*/ | |||
export class SearchTimeoutError extends KbnError { | |||
public mode: TimeoutErrorMode; | |||
constructor(err: Error, mode: TimeoutErrorMode) { | |||
constructor(err: Record<string, any>, mode: TimeoutErrorMode) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this change necessary?
Looks like we creating SearchTimeoutError
where we known we are passing KibanaServerError
Could it be KibanaServerError
then?
…o sessions/error-format
@elasticmachine merge upstream |
@elasticmachine merge upstream |
@elasticmachine merge upstream |
@elasticmachine merge upstream |
expected head sha didn’t match current head ref. |
💚 Build SucceededMetrics [docs]Module Count
Async chunks
Page load bundle
History
To update your PR or re-run it, just comment with: |
* Detect ESError correctly Fix bfetch error (was recognized as unknown error) Make sure handleSearchError always returns an error object. * fix tests and improve types * type * normalize search error response format for search and bsearch * type * Added es search exception examples * Normalize and validate errors thrown from oss es_search_strategy Validate abort * Added tests for search service error handling * Update msearch tests to test for errors * Moved bsearch route to routes folder Adjusted bsearch response format Added verification of error's root cause * Align painless error object * eslint * Add to seach interceptor tests * add json to tsconfig * docs * updated xpack search strategy tests * oops * license header * Add test for xpack painless error format * doc * Fix bsearch test potential flakiness * code review * fix * code review 2 Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
* Detect ESError correctly Fix bfetch error (was recognized as unknown error) Make sure handleSearchError always returns an error object. * fix tests and improve types * type * normalize search error response format for search and bsearch * type * Added es search exception examples * Normalize and validate errors thrown from oss es_search_strategy Validate abort * Added tests for search service error handling * Update msearch tests to test for errors * Moved bsearch route to routes folder Adjusted bsearch response format Added verification of error's root cause * Align painless error object * eslint * Add to seach interceptor tests * add json to tsconfig * docs * updated xpack search strategy tests * oops * license header * Add test for xpack painless error format * doc * Fix bsearch test potential flakiness * code review * fix * code review 2 Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com> Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
Resolves #88570
search
,msearch
,async_search
andbsearch
. The new format isWhile before, the error messages were not shown, now the errors look like this:
Summary
Summarize your PR. If it involves visual changes include a screenshot or gif.
Checklist
Delete any items that are not applicable to this PR.
For maintainers