From 61705ca3611bccefe12e0a6569f7c3b8c6abaa67 Mon Sep 17 00:00:00 2001 From: Rudolf Meijering Date: Mon, 5 Aug 2019 14:35:55 +0200 Subject: [PATCH] Remove err.response from SavedObjects fetch errors --- src/core/public/saved_objects/saved_objects_client.ts | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/core/public/saved_objects/saved_objects_client.ts b/src/core/public/saved_objects/saved_objects_client.ts index de4154474616e..eca73e8dab8e2 100644 --- a/src/core/public/saved_objects/saved_objects_client.ts +++ b/src/core/public/saved_objects/saved_objects_client.ts @@ -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); }); }