mirror of
https://github.com/danielsogl/awesome-cordova-plugins.git
synced 2025-01-19 16:52:53 +08:00
refactor(core): wrapInstance should return promise as-is
instance based method never throw errors like regular ones do
This commit is contained in:
parent
1ec4bdef8f
commit
8aca6718e1
@ -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));
|
||||
|
||||
}
|
||||
};
|
||||
|
Loading…
Reference in New Issue
Block a user