Muljin / msal-flutter

BSD 3-Clause "New" or "Revised" License
9 stars 37 forks source link

MSALPublicClientApplication._convertException should provide more details #16

Closed dJani97 closed 1 year ago

dJani97 commented 1 year ago

Hi!

I've noticed that some exceptions are caught and rethrown with less information. For example, I got the following exception:

"Invalid configuration, please correct your settings and try again"

I had to use the debugger to find out what the original error message was:

Unable to create MSALPublicClientApplication with error: Error Domain=MSALErrorDomain Code=-50000 "(null)" UserInfo={MSALErrorDescriptionKey=The required app scheme "com.example.app" is not registered in the app's info.plist file. Please add "com.example.app" into Info.plist under CFBundleURLSchemes without any whitespaces and make sure that redirectURi "com.example.app://auth" is register in the portal for your app., MSALInternalErrorCodeKey=-42001}

This original message is extremely useful, I would suggest that you always include it in the rethrown error.

The method MSALPublicClientApplication._convertException is responsible for this conversion.

Also, please print these errors on the console, currently (I think) the only way to obtain them is by debugging.

mswehli commented 1 year ago

Thank you for your suggestion, however as we are limited in resources we only add features as we need them for our own projects and clients. We suggest forking the package for any features you might need.