-
Notifications
You must be signed in to change notification settings - Fork 2.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Methods should return always a Promise, also when Cordova or the plugin is not available #294
Comments
Good call, we should do this (surprised we didn't do that from the start...) |
|
@Ritzlgrmft I just checked, in case of an error it still returns a promise that rejects with the error message Can you provide steps to reproduce a case where it returns back an object instead of a promise? Thanks |
I created a new Ionic project with
Maybe this happens because of the sync option? |
Yes it's because of the The |
FYI: #304 |
Par example, look at the method
It declares to return always a Promise object. But that is not true. If either Cordova or the plugin is not available, just an object with a property named
error
is returned.I would prefer, that ionic-native returns in such a case just a rejected Promise. That would make my coding much easier.
With the current implementation, I have to check if the returned value is really a Promise. Only then I can use methods like
then()
on it. Otherwise I would get unexpected errors at least while testing in the browser.The text was updated successfully, but these errors were encountered: