mirror of
https://github.com/elastic/kibana.git
synced 2025-04-23 17:28:26 -04:00
Remove err.response from SavedObjects fetch errors
This commit is contained in:
parent
53f6800465
commit
61705ca361
1 changed files with 5 additions and 1 deletions
|
@ -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);
|
||||
});
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue