From 357e984b8073bcf645abe85a9273cc270b3a22b1 Mon Sep 17 00:00:00 2001 From: fxy060608 Date: Mon, 13 May 2019 11:58:49 +0800 Subject: [PATCH] fix #380 --- src/core/helpers/promise.js | 22 ++++++++++++---------- 1 file changed, 12 insertions(+), 10 deletions(-) diff --git a/src/core/helpers/promise.js b/src/core/helpers/promise.js index 3a9fad8bf..59f1087f5 100644 --- a/src/core/helpers/promise.js +++ b/src/core/helpers/promise.js @@ -56,16 +56,18 @@ export function promisify (name, api) { success: resolve, fail: reject }), ...params) - /* eslint-disable no-extend-native */ - Promise.prototype.finally = function (callback) { - const promise = this.constructor - return this.then( - value => promise.resolve(callback()).then(() => value), - reason => promise.resolve(callback()).then(() => { - throw reason - }) - ) - } + /* eslint-disable no-extend-native */ + try { + Promise.prototype.finally = function (callback) { + const promise = this.constructor + return this.then( + value => promise.resolve(callback()).then(() => value), + reason => promise.resolve(callback()).then(() => { + throw reason + }) + ) + } + } catch (e) {} })) } } -- GitLab