File tree Expand file tree Collapse file tree
packages/react-native-app-auth/ios Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -730,14 +730,22 @@ - (NSString*)getErrorCode: (NSError*) error defaultCode: (NSString *) defaultCod
730730
731731- (NSString *)getErrorMessage : (NSError *) error {
732732 NSDictionary * userInfo = [error userInfo ];
733+ NSString *message;
733734
734735 if (userInfo &&
735736 userInfo[OIDOAuthErrorResponseErrorKey] &&
736737 userInfo[OIDOAuthErrorResponseErrorKey][OIDOAuthErrorFieldErrorDescription]) {
737- return userInfo[OIDOAuthErrorResponseErrorKey][OIDOAuthErrorFieldErrorDescription];
738+ message = userInfo[OIDOAuthErrorResponseErrorKey][OIDOAuthErrorFieldErrorDescription];
738739 } else {
739- return [error localizedDescription ];
740+ message = [error localizedDescription ];
740741 }
742+
743+ NSError *underlyingError = userInfo[NSUnderlyingErrorKey ];
744+ if (underlyingError && [underlyingError isKindOfClass: [NSError class ]] && [underlyingError localizedDescription ]) {
745+ message = [message stringByAppendingFormat: @" - Cause: %@ " , [underlyingError localizedDescription ]];
746+ }
747+
748+ return message;
741749}
742750
743751- (id <OIDExternalUserAgent>)getExternalUserAgentWithPresentingViewController : (UIViewController *)presentingViewController
You can’t perform that action at this time.
0 commit comments