Faisalkc4u / uae_pass

MIT License
6 stars 10 forks source link

Unhandled Exception: Authentication Process Canceled By User. #6

Closed anakin001 closed 1 year ago

anakin001 commented 1 year ago

No idea how could I handle error when user cancels the signIn process

anakin001 commented 1 year ago

@Faisalkc4u hi, could you help with this issue?

faisalkcmvp commented 1 year ago

It gives an exception

anakin001 commented 1 year ago
try {
      final code = await _uaePassPlugin.signIn();
      }on Exception catch(e){
      debugPrint(e.toString());
      }

It doesnt catch the exception from my end, is there something wrong with my code? The following are the errors..

 E/flutter ( 5973): [ERROR:flutter/runtime/dart_vm_initializer.cc(41)] Unhandled Exception: cancelledOnApp
E/flutter ( 5973): #0      UaePass.signIn
uae_pass.dart:30
E/flutter ( 5973): <asynchronous suspension>
E/flutter ( 5973): #1      _SignInState.signIn
sign_in.dart:58
E/flutter ( 5973): <asynchronous suspension>
faisalkcmvp commented 1 year ago
 catch (e) {
                      if (mounted) {
                       .....showSnackBar(
                          (e.toString() == "cancel" ||
                                  e.toString() == "cancelledOnApp" ||
                                  "cancelled" == e.toString())
                              ? "User cancelled the login"
                              : e.toString(),
                        );
                      }
                    }
anakin001 commented 1 year ago

thanks, I removed the on Exception, and it worked