From 9fdf30abbd87707fe12ea375b3650c303dbd43a6 Mon Sep 17 00:00:00 2001 From: dongdayu Date: Fri, 8 Jun 2018 18:02:04 +0800 Subject: [PATCH] =?UTF-8?q?BUG=20FIX:=20=E5=AE=89=E5=8D=93=20Object=20?= =?UTF-8?q?=E6=B2=A1=E6=9C=89=20setPrototypeOf=20=E6=96=B9=E6=B3=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/index.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/index.js b/src/index.js index 3aba6ce..38332f8 100644 --- a/src/index.js +++ b/src/index.js @@ -315,6 +315,10 @@ export class WechatError extends Error { this.errCode = errCode this.errMsg = errMsg - Object.setPrototypeOf(this, WechatError.prototype) + if (typeof Object.setPrototypeOf === 'function') { + Object.setPrototypeOf(this, WechatError.prototype) + } else { + this.__proto__ = WechatError.prototype + } } }