Skip to content

Commit

Permalink
Remove err.response from SavedObjects fetch errors
Browse files Browse the repository at this point in the history
  • Loading branch information
rudolf committed Aug 5, 2019
1 parent 53f6800 commit 61705ca
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/core/public/saved_objects/saved_objects_client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -423,11 +423,15 @@ export class SavedObjectsClient {
/**
* To ensure we don't break backwards compatibility, savedObjectsFetch keeps
* the old kfetch error format of `{res: {status: number}}` whereas `http.fetch`
* uses `{response: {status: number}}`
* uses `{response: {status: number}}`.
*
* TODO: Introduce error helper functions to make it easier to change
* the internal shape of errors.
*/
private savedObjectsFetch(path: string, { method, query, body }: HttpFetchOptions) {
return this.http.fetch(path, { method, query, body }).catch(err => {
const kfetchError = Object.assign(err, { res: err.response });
delete kfetchError.response;
return Promise.reject(kfetchError);
});
}
Expand Down

0 comments on commit 61705ca

Please sign in to comment.