Skip to content

Commit

Permalink
Prevent service from changing the shape of our errors
Browse files Browse the repository at this point in the history
This ensures a consistent interface for our kibana client errors,
whether the error is raised directly from a `fetch` or emitted from a
search strategy's observable; namely: that both contain this top-level
`body` key.
  • Loading branch information
rylnd committed Oct 28, 2020
1 parent 649fe56 commit 26cacfa
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/plugins/data/public/search/errors/es_error.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,11 @@ import { IEsError } from './types';
import { getRootCause, getTopLevelCause } from './utils';

export class EsError extends KbnError {
protected readonly body: IEsError['body'];

constructor(protected readonly err: IEsError) {
super('EsError');
this.body = err.body;
}

public getErrorMessage(application: ApplicationStart) {
Expand Down

0 comments on commit 26cacfa

Please sign in to comment.