feat: Better error handling for 'native' plugins.
See original GitHub issueFeature 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
- Android
- iOS
- Electron
- Web
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.
Issue Analytics
- State:
- Created 4 years ago
- Reactions:10
- Comments:7 (4 by maintainers)
It is difficult to categorise
Filesystem
errors across different platforms, for example:Perhaps well documented
err.code
properties could be implemented?I’d like to see a general error for a
file not found
scenario as well as the actual platform specific error. Some people might want to handle platform specific errors after all.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.