-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Description
Capacitor Version
💊 Capacitor Doctor 💊
Latest Dependencies:
@capacitor/cli: 6.1.2
@capacitor/core: 6.1.2
@capacitor/android: 6.1.2
@capacitor/ios: 6.1.2
Installed Dependencies:
@capacitor/cli: 6.0.0
@capacitor/core: 6.0.0
@capacitor/android: 6.0.0
@capacitor/ios: 6.0.0
[success] iOS looking great! 👌
[success] Android looking great! 👌
Other API Details
No response
Platforms Affected
- iOS
- Android
- Web
Current Behavior
The Capacitor Android/iOS SDK allow rejecting a call with a code of type string, see:
| public void reject(String msg, String code, Exception ex) { |
However, the type of the code property of the CapacitorException class only allows values of type ExceptionCode, see:
Line 29 in f3239c4
| readonly code?: ExceptionCode, |
For example, the Capacitor Firebase Authnentication plugin uses the code property to forward the error code from the Firebase SDK to the WebView in addition to the error message. Currently a typecast has to be used to get the correct type of the property:
private getMessageFromCapacitorException(error: CapacitorException): string {
switch (error.code as string) {
case 'email-already-in-use': {
return this.translocoService.translate(
'core.message.error.firebase.auth.emailAlreadyInUse',
);
}
...
}
}Expected Behavior
The type of the code property should be of type CapacitorException | string.
Project Reproduction
https://github.com/robingenz/capacitor-firebase-authentication-demo
Additional Information
No response