-
Notifications
You must be signed in to change notification settings - Fork 1k
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
feat: Better error handling for 'native' plugins. #2443
Comments
javascript errors can have a code number and a few other properties, so this could be done Adding the needs discussion label |
It is difficult to categorise
Perhaps well documented |
This comment was marked as abuse.
This comment was marked as abuse.
I'd like to see a general error for a One thing that would really help is just documentation around the errors object it throws and the possible messages you can get. I have no idea what kind of error scenarios I can expect and how to handle them properly without going through the source code. |
Reviving this feture request because this is absolutely needed. For example I want to delete a file. If the file does not exist its ok because I wanted to delete it anyway. But I want an display an error message if I do not have the permissions to delete it.
|
Even this solution unfortunately only works if the device is set to English (please correct me if I am wrong). |
I just assume that every error is a File Not Found. But this is a little bit dangerous because it could result in an existing file being inadvertently overwritten. |
FWIW I think that all plugins produce the same error object, which is basically
So it's possible for plugins to supply a code that would presumably be easier to use, but most don't do so, they only supply the message. In most plugins it's a hard-coded English string, |
Feature Request
Describe the Feature Request
Hey guys, we are running into issues when handling plugins on native devices.
For example the
Geolocation.getCurrentLocation()
function returns a different error object on web than it does on native devices.The error object on this particular function on native devices currently only holds a
message
property. Without any documentation, it is hard to see what kind of errors it may throw and to write code around handling these errors.The error object on web is the GeolocationPositionError. It's a lot easier to write different methods around the types of errors it can throw.
The same goes for other plugins like the Camera plugin.
Platform Support Requested
Describe Preferred Solution
The preferred solution would be a single error object that we can use to handle the error in the same way across platforms. It would also help to have documentation of the errors that certain functions throw. I currently have to search for the error types in the
@capacitor/core
package.The text was updated successfully, but these errors were encountered: