chore(): add try/catch for callCordovaPlugin method

closes #882
This commit is contained in:
Ibby 2017-01-07 05:26:38 -05:00
parent 2c57bc965c
commit 54d1a9891b

View File

@ -124,7 +124,15 @@ function callCordovaPlugin(pluginObj: any, methodName: string, args: any[], opts
} }
// TODO: Illegal invocation needs window context // TODO: Illegal invocation needs window context
return get(window, pluginObj.pluginRef)[methodName].apply(pluginInstance, args); let value;
try {
value = get(window, pluginObj.pluginRef)[methodName].apply(pluginInstance, args);
} catch (e) {
value = {
error: 'cordova_not_available'
}
}
return value;
} }
/** /**