kibana/packages/kbn-bfetch-error
Nathan Reese bb84e24637
@kbn/search-errors package (#171563)
Part of https://github.com/elastic/kibana/issues/171570

PR breaks EsError out of data plugin and into @kbn/search-errors
package. This will allow for future efforts to move [lens error
handing](https://github.com/elastic/kibana/blob/main/x-pack/plugins/lens/public/editor_frame_service/error_helper.tsx)
into this package and more closely align error handling across kibana.

An unplanned part of this PR was moving `BfetchRequestError` into its
own package `@kbn/bfetch`. This is required because `@kbn/search-errors`
package can not import code from a plugin. `BfetchRequestError` could
not be part of `@kbn/search-errors` because that created a circular
dependency graph.

Another unexpected problem found while working on this PR is that the
package had to be included in `ui-shared-deps`. The reason for this is
that `renderSearchError` uses `instanceof EsError` check to determine if
an error is an EsError. This check failed when the package was not
included in `ui-shared-deps` because each plugin got its own copy of
`kbn/search-error` plugin. This meant that `data` plugin had its own
copy of `EsError` class when the error is generated, then `discover`
plugin had its own copy of `EsError` class when the instanceof check
occurs. `instanceof` check unexpectedly returned false in this case.
Moving plugin to `ui-shared-deps` results in a single instance of the
plugin. Thanks @mistic for the help with moving package into
`ui-shared-deps`

---------

Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>
Co-authored-by: Tiago Costa <tiago.costa@elastic.co>
Co-authored-by: Davis McPhee <davismcphee@hotmail.com>
2023-12-07 10:39:19 -07:00
..
src @kbn/search-errors package (#171563) 2023-12-07 10:39:19 -07:00
BUILD.bazel @kbn/search-errors package (#171563) 2023-12-07 10:39:19 -07:00
index.ts @kbn/search-errors package (#171563) 2023-12-07 10:39:19 -07:00
jest.config.js @kbn/search-errors package (#171563) 2023-12-07 10:39:19 -07:00
kibana.jsonc @kbn/search-errors package (#171563) 2023-12-07 10:39:19 -07:00
package.json @kbn/search-errors package (#171563) 2023-12-07 10:39:19 -07:00
README.md @kbn/search-errors package (#171563) 2023-12-07 10:39:19 -07:00
tsconfig.json @kbn/search-errors package (#171563) 2023-12-07 10:39:19 -07:00

@kbn/bfetch-error

package isolating befetch error logic