Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

[ESD-30932] Improve error handling #720

Merged
merged 12 commits into from
Sep 25, 2023
Merged

[ESD-30932] Improve error handling #720

merged 12 commits into from
Sep 25, 2023

Conversation

poovamraj
Copy link
Contributor

@poovamraj poovamraj commented Sep 15, 2023

Changes

  • We have added more detailed error codes to Android and iOS
  • We propagate the error stack trace from Android to JS
  • Updated migration guide on error code changes

References

Testing

We have done manual testing to ensure the error details are propagated

@poovamraj poovamraj requested a review from a team as a code owner September 15, 2023 11:23
@rick-lannan-upgrowth
Copy link

Hi, thanks for looking at this. I notice this seems to only be for Android. Is there more code or another PR coming that forwards the api error code and description on iOS devices as well?

@poovamraj
Copy link
Contributor Author

@rick-lannan-upgrowth agree with you on that. I have pushed more changes to include backend error codes for iOS as well. Can you take a look?

@rick-lannan-upgrowth
Copy link

Hi @poovamraj, looks good. It seems that iOS and Android seem to be returning the root cause api error code and description now. I look forward to testing this one

@poovamraj
Copy link
Contributor Author

@Widcket Can you review the iOS part of this PR?

@auth0/dx-sdks-engineer Anyone up for reviewing this PR?

@poovamraj
Copy link
Contributor Author

Manual testing results

Before
iOS

{"code":"OTHER","message":"An unexpected error occurred. CAUSE: Transaction failed, integrity_token not provided","domain":"Auth0.WebAuthError","userInfo":{},"nativeStackIOS":["0   Auth0Example                        0x00000001054e08e0 RCTJSErrorFromCodeMessageAndNSError + 112","1   Auth0Example                        0x000000010547d764 __41-[RCTModuleMethod processMethodSignature]_block_invoke_2.73 + 152","2   Auth0Example                        0x0000000104f4ce90 $sSo8NSStringCSgACSo7NSErrorCSgIeyByyy_SSSgAGs5Error_pSgIegggg_TR + 380","3   Auth0Example                        0x0000000104f4ba14 $s7A0Auth012NativeBridgeC7webAuth5state11redirectUri5nonce8audience5scope10connection6maxAge12organization13invitationUrl6leeway16ephemeralSession20additionalParameters7resolve6rejectySSSg_SSA4SSiA2SSiSbSDyS2SGyypSgcyAS_ASs5Error_pSgtctFys6ResultOy0B011CredentialsCAZ03WebfZ0VGcfU_ + 620","4   Auth0Example                        0x0000000104f6bae0 $s5Auth00A7WebAuthC5startyyys6ResultOyAA11CredentialsCAA0bC5ErrorVGcFyAFyytAJGcfU1_ + 412","5   Auth0Example                        0x0000000104f668b4 $ss6ResultOyyt5Auth012WebAuthErrorVGIegg_AFytIegnr_TR + 48","6   Auth0Example                        0x0000000104f66678 $ss6ResultOyyt5Auth012WebAuthErrorVGytIegnr_AFIegg_TR + 64","7   Auth0Example                        0x0000000104f54620 $s5Auth011ASUserAgentC6finish4withys6ResultOyytAA12WebAuthErrorVG_tF + 132","8   Auth0Example                        0x0000000104f54c84 $s5Auth011ASUserAgentCAA011WebAuthUserC0A2aDP6finish4withys6ResultOyytAA0dE5ErrorVG_tFTW + 44","9   Auth0Example                        0x0000000104fac670 $s5Auth016LoginTransactionC15finishUserAgent33_E115A77A03861564EEB2F12F162C93CCLL4withys6ResultOyytAA12WebAuthErrorVG_tF + 172","10  Auth0Example                        0x0000000104fac284 $s5Auth016LoginTransactionC9handleURL33_E115A77A03861564EEB2F12F162C93CCLLySb10Foundation0E0VF + 1380","11  Auth0Example                        0x0000000104fabd00 $s5Auth016LoginTransactionC6resumeySb10Foundation3URLVF + 212","12  Auth0Example                        0x0000000104facec0 $s5Auth016LoginTransactionCAA04AuthC0A2aDP6resumeySb10Foundation3URLVFTW + 44","13  Auth0Example                        0x0000000104fc1e8c $s5Auth016TransactionStoreC6resumeySb10Foundation3URLVF + 160","14  Auth0Example                        0x0000000104f53ed8 $s5Auth017WebAuthenticationV10asProvider9urlScheme16ephemeralSessionAA0B13AuthUserAgent_p10Foundation3URLV_ys6ResultOyytAA0bJ5ErrorVGctcSS_SbtFZAaG_pAJ_yAOctcfU_yAJSg_s0P0_pSgtcfU_ + 452","15  Auth0Example                        0x0000000104f54f7c $s10Foundation3URLVSgs5Error_pSgIegng_So5NSURLCSgSo7NSErrorCSgIeyByy_TR + 396","16  AuthenticationServices              0x000000010724825c __111-[ASWebAuthenticationSession initWithURL:callbackURLScheme:usingEphemeralSession:jitEnabled:completionHandler:]_block_invoke + 148","17  SafariServices                      0x00000001097fa0fc -[SFAuthenticationSession safariViewController:hostApplicationOpenURL:] + 116","18  SafariServices                      0x0000000109843b8c -[SFAuthenticationViewController remoteViewController:hostApplicationOpenURL:] + 76","19  SafariServices                      0x000000010988ebf0 -[SFBrowserRemoteViewController willOpenURLInHostApplication:] + 68","20  CoreFoundation                      0x000000018046bed0 __invoking___ + 144","21  CoreFoundation                      0x0000000180469234 -[NSInvocation invoke] + 276","22  libdispatch.dylib                   0x0000000180143d3c _dispatch_client_callout + 16","23  libdispatch.dylib                   0x0000000180147c4c _dispatch_block_invoke_direct + 376","24  FrontBoardServices                  0x0000000185498fa0 __FBSSERIALQUEUE_IS_CALLING_OUT_TO_A_BLOCK__ + 44","25  FrontBoardServices                  0x0000000185498e7c -[FBSMainRunLoopSerialQueue _targetQueue_performNextIfPossible] + 196","26  FrontBoardServices                  0x0000000185498fd4 -[FBSMainRunLoopSerialQueue _performNextFromRunLoopSource] + 24","27  CoreFoundation                      0x00000001803c669c __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ + 24","28  CoreFoundation                      0x00000001803c65e4 __CFRunLoopDoSource0 + 172","29  CoreFoundation                      0x00000001803c5d54 __CFRunLoopDoSources0 + 232","30  CoreFoundation                      0x00000001803c043c __CFRunLoopRun + 768","31  CoreFoundation                      0x00000001803bfd28 CFRunLoopRunSpecific + 572","32  GraphicsServices                    0x000000018986ebc0 GSEventRunModal + 160","33  UIKitCore                           0x0000000114d2bfdc -[UIApplication _run] + 868","34  UIKitCore                           0x0000000114d2fc54 UIApplicationMain + 124","35  Auth0Example                        0x0000000104f483ac main + 100","36  dyld                                0x000000010715d558 start_sim + 20","37  ???                                 0x00000001073d5f28 0x0 + 4416429864","38  ???                                 0x5b51000000000000 0x0 + 6580040530565005312"]}

Android

{"nativeStackAndroid":[],"userInfo":null,"message":"An error occurred when trying to authenticate with the server.","code":"a0.response.invalid"}

After
iOS

{"code":"access_denied","message":"An unexpected error occurred. CAUSE: Transaction failed, integrity_token not provided","domain":"Auth0.WebAuthError","userInfo":{},"nativeStackIOS":["0   Auth0Example                        0x0000000100e488e0 RCTJSErrorFromCodeMessageAndNSError + 112","1   Auth0Example                        0x0000000100de5764 __41-[RCTModuleMethod processMethodSignature]_block_invoke_2.73 + 152","2   Auth0Example                        0x00000001008b4c3c $sSo8NSStringCSgACSo7NSErrorCSgIeyByyy_SSSgAGs5Error_pSgIegggg_TR + 380","3   Auth0Example                        0x00000001008b3694 $s7A0Auth012NativeBridgeC7webAuth5state11redirectUri5nonce8audience5scope10connection6maxAge12organization13invitationUrl6leeway16ephemeralSession20additionalParameters7resolve6rejectySSSg_SSA4SSiA2SSiSbSDyS2SGyypSgcyAS_ASs5Error_pSgtctFys6ResultOy0B011CredentialsCAZ03WebfZ0VGcfU_ + 620","4   Auth0Example                        0x00000001008d3ae4 $s5Auth00A7WebAuthC5startyyys6ResultOyAA11CredentialsCAA0bC5ErrorVGcFyAFyytAJGcfU1_ + 412","5   Auth0Example                        0x00000001008ce8b8 $ss6ResultOyyt5Auth012WebAuthErrorVGIegg_AFytIegnr_TR + 48","6   Auth0Example                        0x00000001008ce67c $ss6ResultOyyt5Auth012WebAuthErrorVGytIegnr_AFIegg_TR + 64","7   Auth0Example                        0x00000001008bc624 $s5Auth011ASUserAgentC6finish4withys6ResultOyytAA12WebAuthErrorVG_tF + 132","8   Auth0Example                        0x00000001008bcc88 $s5Auth011ASUserAgentCAA011WebAuthUserC0A2aDP6finish4withys6ResultOyytAA0dE5ErrorVG_tFTW + 44","9   Auth0Example                        0x0000000100914674 $s5Auth016LoginTransactionC15finishUserAgent33_E115A77A03861564EEB2F12F162C93CCLL4withys6ResultOyytAA12WebAuthErrorVG_tF + 172","10  Auth0Example                        0x0000000100914288 $s5Auth016LoginTransactionC9handleURL33_E115A77A03861564EEB2F12F162C93CCLLySb10Foundation0E0VF + 1380","11  Auth0Example                        0x0000000100913d04 $s5Auth016LoginTransactionC6resumeySb10Foundation3URLVF + 212","12  Auth0Example                        0x0000000100914ec4 $s5Auth016LoginTransactionCAA04AuthC0A2aDP6resumeySb10Foundation3URLVFTW + 44","13  Auth0Example                        0x0000000100929e90 $s5Auth016TransactionStoreC6resumeySb10Foundation3URLVF + 160","14  Auth0Example                        0x00000001008bbedc $s5Auth017WebAuthenticationV10asProvider9urlScheme16ephemeralSessionAA0B13AuthUserAgent_p10Foundation3URLV_ys6ResultOyytAA0bJ5ErrorVGctcSS_SbtFZAaG_pAJ_yAOctcfU_yAJSg_s0P0_pSgtcfU_ + 452","15  Auth0Example                        0x00000001008bcf80 $s10Foundation3URLVSgs5Error_pSgIegng_So5NSURLCSgSo7NSErrorCSgIeyByy_TR + 396","16  AuthenticationServices              0x00000001037b025c __111-[ASWebAuthenticationSession initWithURL:callbackURLScheme:usingEphemeralSession:jitEnabled:completionHandler:]_block_invoke + 148","17  SafariServices                      0x00000001050960fc -[SFAuthenticationSession safariViewController:hostApplicationOpenURL:] + 116","18  SafariServices                      0x00000001050dfb8c -[SFAuthenticationViewController remoteViewController:hostApplicationOpenURL:] + 76","19  SafariServices                      0x000000010512abf0 -[SFBrowserRemoteViewController willOpenURLInHostApplication:] + 68","20  CoreFoundation                      0x000000018046bed0 __invoking___ + 144","21  CoreFoundation                      0x0000000180469234 -[NSInvocation invoke] + 276","22  libdispatch.dylib                   0x0000000180143d3c _dispatch_client_callout + 16","23  libdispatch.dylib                   0x0000000180147c4c _dispatch_block_invoke_direct + 376","24  FrontBoardServices                  0x0000000185498fa0 __FBSSERIALQUEUE_IS_CALLING_OUT_TO_A_BLOCK__ + 44","25  FrontBoardServices                  0x0000000185498e7c -[FBSMainRunLoopSerialQueue _targetQueue_performNextIfPossible] + 196","26  FrontBoardServices                  0x0000000185498fd4 -[FBSMainRunLoopSerialQueue _performNextFromRunLoopSource] + 24","27  CoreFoundation                      0x00000001803c669c __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ + 24","28  CoreFoundation                      0x00000001803c65e4 __CFRunLoopDoSource0 + 172","29  CoreFoundation                      0x00000001803c5d54 __CFRunLoopDoSources0 + 232","30  CoreFoundation                      0x00000001803c043c __CFRunLoopRun + 768","31  CoreFoundation                      0x00000001803bfd28 CFRunLoopRunSpecific + 572","32  GraphicsServices                    0x000000018986ebc0 GSEventRunModal + 160","33  UIKitCore                           0x00000001105c7fdc -[UIApplication _run] + 868","34  UIKitCore                           0x00000001105cbc54 UIApplicationMain + 124","35  Auth0Example                        0x00000001008b002c main + 100","36  dyld                                0x0000000102ac5558 start_sim + 20","37  ???                                 0x0000000102c71f28 0x0 + 4341571368","38  ???                                 0x2318000000000000 0x0 + 2528771190768533504"]}

Android

{"nativeStackAndroid":[{"lineNumber":198,"file":"OAuthManager.kt","methodName":"assertNoError","class":"com.auth0.android.provider.OAuthManager"},{"lineNumber":95,"file":"OAuthManager.kt","methodName":"resume","class":"com.auth0.android.provider.OAuthManager"},{"lineNumber":77,"file":"WebAuthProvider.kt","methodName":"resume","class":"com.auth0.android.provider.WebAuthProvider"},{"lineNumber":86,"file":"AuthenticationActivity.kt","methodName":"deliverAuthenticationResult$auth0_release","class":"com.auth0.android.provider.AuthenticationActivity"},{"lineNumber":54,"file":"AuthenticationActivity.kt","methodName":"onResume","class":"com.auth0.android.provider.AuthenticationActivity"},{"lineNumber":1603,"file":"Instrumentation.java","methodName":"callActivityOnResume","class":"android.app.Instrumentation"},{"lineNumber":8743,"file":"Activity.java","methodName":"performResume","class":"android.app.Activity"},{"lineNumber":4951,"file":"ActivityThread.java","methodName":"performResumeActivity","class":"android.app.ActivityThread"},{"lineNumber":4994,"file":"ActivityThread.java","methodName":"handleResumeActivity","class":"android.app.ActivityThread"},{"lineNumber":57,"file":"ResumeActivityItem.java","methodName":"execute","class":"android.app.servertransaction.ResumeActivityItem"},{"lineNumber":45,"file":"ActivityTransactionItem.java","methodName":"execute","class":"android.app.servertransaction.ActivityTransactionItem"},{"lineNumber":180,"file":"TransactionExecutor.java","methodName":"executeLifecycleState","class":"android.app.servertransaction.TransactionExecutor"},{"lineNumber":98,"file":"TransactionExecutor.java","methodName":"execute","class":"android.app.servertransaction.TransactionExecutor"},{"lineNumber":2443,"file":"ActivityThread.java","methodName":"handleMessage","class":"android.app.ActivityThread$H"},{"lineNumber":106,"file":"Handler.java","methodName":"dispatchMessage","class":"android.os.Handler"},{"lineNumber":205,"file":"Looper.java","methodName":"loopOnce","class":"android.os.Looper"},{"lineNumber":294,"file":"Looper.java","methodName":"loop","class":"android.os.Looper"},{"lineNumber":8176,"file":"ActivityThread.java","methodName":"main","class":"android.app.ActivityThread"},{"lineNumber":-2,"file":"Method.java","methodName":"invoke","class":"java.lang.reflect.Method"},{"lineNumber":552,"file":"RuntimeInit.java","methodName":"run","class":"com.android.internal.os.RuntimeInit$MethodAndArgsCaller"},{"lineNumber":971,"file":"ZygoteInit.java","methodName":"main","class":"com.android.internal.os.ZygoteInit"}],"userInfo":null,"message":"An error occurred when trying to authenticate with the server.","code":"access_denied"}

@poovamraj poovamraj requested review from Widcket and a team September 21, 2023 08:17
@poovamraj poovamraj requested a review from Widcket September 22, 2023 12:58
@rick-lannan-upgrowth
Copy link

@poovamraj @Widcket any updates?

@poovamraj
Copy link
Contributor Author

@rick-lannan-upgrowth as you can see we are in the process of reviewing the PR. @Widcket will verify the iOS changes and we can merge it and then continue with the release.

@poovamraj poovamraj merged commit 61e0e11 into master Sep 25, 2023
@poovamraj poovamraj deleted the improve-error-handling branch September 25, 2023 13:32
@rick-lannan-upgrowth
Copy link

Hi again, just wondering when the release is coming out? Thanks

@poovamraj
Copy link
Contributor Author

Hi @rick-lannan-upgrowth we have released the new version. Do check it out and let us know your feedback.

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants