@@ -714,10 +714,10 @@ - (BOOL)grey_handleFailureOfAction:(id<GREYAction>)action
714714 [GREYError grey_nestedDescriptionForError: actionError]);
715715 } else {
716716 if ([actionError isKindOfClass: [GREYError class ]]) {
717- NSMutableDictionary *errorDetails = [[ NSMutableDictionary alloc ] init ] ;
718- errorDetails[ kErrorDetailActionNameKey ] = action. name ;
717+ GREYError *greyError = (GREYError *)actionError ;
718+ NSMutableDictionary * errorDetails = [[ NSMutableDictionary alloc ] initWithDictionary: greyError.errorInfo] ;
719719 errorDetails[kErrorDetailElementMatcherKey ] = _elementMatcher.description ;
720- [(GREYError *)actionError setErrorInfo: errorDetails];
720+ [greyError setErrorInfo: errorDetails];
721721 }
722722 *userProvidedError = actionError;
723723 }
@@ -896,10 +896,10 @@ - (BOOL)grey_handleFailureOfAssertion:(id<GREYAssertion>)assertion
896896 [GREYError grey_nestedDescriptionForError: assertionError]);
897897 } else {
898898 if ([assertionError isKindOfClass: [GREYError class ]]) {
899- NSMutableDictionary *errorDetails = [[ NSMutableDictionary alloc ] init ] ;
900- errorDetails[ kErrorDetailActionNameKey ] = assertion. name ;
899+ GREYError *greyError = (GREYError *)assertionError ;
900+ NSMutableDictionary * errorDetails = [[ NSMutableDictionary alloc ] initWithDictionary: greyError.errorInfo] ;
901901 errorDetails[kErrorDetailElementMatcherKey ] = _elementMatcher.description ;
902- [(GREYError *)assertionError setErrorInfo: errorDetails];
902+ [greyError setErrorInfo: errorDetails];
903903 }
904904 *userProvidedError = assertionError;
905905 }
0 commit comments