[data.search] Fix unhandled promise rejections#181785
[data.search] Fix unhandled promise rejections#181785lukasolson merged 3 commits intoelastic:mainfrom
Conversation
|
/ci |
|
Pinging @elastic/kibana-data-discovery (Team:DataDiscovery) |
💛 Build succeeded, but was flaky
Failed CI StepsTest Failures
Metrics [docs]Page load bundle
Unknown metric groupsESLint disabled line counts
Total ESLint disabled count
History
To update your PR or re-run it, just comment with: cc @lukasolson |
davismcphee
left a comment
There was a problem hiding this comment.
Thanks for addressing it! LGTM 👍
|
|
||
| const safeCancel = () => | ||
| cancel?.().catch((e) => { | ||
| console.error(e); // eslint-disable-line no-console |
There was a problem hiding this comment.
I wonder if we should use the Core Logger for this instead? Or can we not because it's in common?
There was a problem hiding this comment.
Yeah, since it's used on both the client and server this presents some challenges. I tried passing in the Logger client-side and I'm not sure where it actually logs to because I don't see it in the console. It's also just a bit convoluted since we have to pass the logger all the way from the plugin down to pollSearch.
There was a problem hiding this comment.
Makes sense, thanks for looking into it anyway!
* master: (1654 commits) Bump ejs from 3.1.9 to 3.1.10 Don't render exceptions flyout if data is loading (elastic#181588) Enable value list modal (elastic#181593) skip flaky suite (elastic#181777) skip failing test suite (elastic#182263) [Mappings Editor] Disable _source field in serverless (elastic#181712) [data.search] Fix unhandled promise rejections (elastic#181785) [Fleet] Fix logic for detecting first time Elastic Agent users (elastic#182214) [ML] Decouple data_visualizer from MapEmbeddable (elastic#181928) [ES|QL] Sorting accepts expressions (elastic#181916) [ML] Single Metric Viewer: ensures chart displays correctly when opening from a job annotation (elastic#182176) Adding optional Description field to Roles APIs (elastic#182039) Upgrade Markdown-it to 14.1.0 (elastic#182244) Bump xml-crypto from 5.0.0 to 6.0.0 [DOCS] Fix docs and screenshots for rule creation changes (elastic#181925) Update dependency elastic-apm-node to ^4.5.3 (main) (elastic#182236) [Obs AI Assistant] register alert details context in observability plugin (elastic#181501) Add `@typescript-eslint/no-floating-promises` (elastic#181456) [Playground] Propagate Error message into FE (elastic#182201) [ES|QL] Rename the setting to a more generic one and move to the general section (elastic#182074) ...
Summary
Resolves #168957.
It turns out the underlying issue was resolved in #170041 (unhandled errors when deleting not being handled). However this still left it up to consumers of
pollSearchto be 100% sure they weren't leaking unhandled promise rejections. This adds code directly topollSearchthat will handle rejections if they aren't handled in the calling code. It also adds tests to consumers ofpollSearchto make sure they don't barf in the case that thecancelfunction errors.Checklist