From 8aca6718e16e8dde54bc6f3ee51a45ea0d47f8c9 Mon Sep 17 00:00:00 2001 From: Ibby Hadeed Date: Wed, 17 May 2017 10:46:47 -0400 Subject: [PATCH] refactor(core): wrapInstance should return promise as-is instance based method never throw errors like regular ones do --- src/@ionic-native/core/plugin.ts | 11 +---------- 1 file changed, 1 insertion(+), 10 deletions(-) diff --git a/src/@ionic-native/core/plugin.ts b/src/@ionic-native/core/plugin.ts index 90d8876b0..f369ba60d 100644 --- a/src/@ionic-native/core/plugin.ts +++ b/src/@ionic-native/core/plugin.ts @@ -297,16 +297,7 @@ export function wrapInstance(pluginObj: any, methodName: string, opts: any = {}) } else { - let pluginResult: any, rej: Function; - const p = getPromise((resolve: Function, reject: Function) => { - pluginResult = callInstance(pluginObj, methodName, args, opts, resolve, reject); - rej = reject; - }); - if (pluginResult && pluginResult.error) { - p.catch(() => { }); - typeof rej === 'function' && rej(pluginResult.error); - } - return p; + return getPromise((resolve: Function, reject: Function) => callInstance(pluginObj, methodName, args, opts, resolve, reject)); } };