Revision: 13536
http://sourceforge.net/p/skim-app/code/13536
Author: hofman
Date: 2023-07-25 23:18:43 +0000 (Tue, 25 Jul 2023)
Log Message:
-----------
Don't add duplicate descriptions for combined error
Modified Paths:
--------------
trunk/NSError_SKExtensions.m
Modified: trunk/NSError_SKExtensions.m
===================================================================
--- trunk/NSError_SKExtensions.m 2023-07-24 15:37:20 UTC (rev 13535)
+++ trunk/NSError_SKExtensions.m 2023-07-25 23:18:43 UTC (rev 13536)
@@ -73,10 +73,16 @@
if ([errors count] > 1) {
NSMutableDictionary *userInfo = [[error userInfo] mutableCopy];
NSString *description;
- if ([errors count] > max)
- description = [[[[errors subarrayWithRange:NSMakeRange(0, max)]
valueForKey:@"localizedDescription"] componentsJoinedByString:@"\n"]
stringByAppendingFormat:@"\n%C", ELLIPSIS_CHARACTER];
+ NSMutableArray *descriptions = [NSMutableArray array];
+ for (NSError *err in errors) {
+ NSString *desc = [err localizedDescription];
+ if ([descriptions containsObject:desc] == NO)
+ [descriptions addObject:desc];
+ }
+ if ([descriptions count] > max)
+ description = [[[descriptions subarrayWithRange:NSMakeRange(0,
max)] componentsJoinedByString:@"\n"] stringByAppendingFormat:@"\n%C",
ELLIPSIS_CHARACTER];
else
- description = [[errors valueForKey:@"localizedDescription"]
componentsJoinedByString:@"\n"];
+ description = [[descriptions valueForKey:@"localizedDescription"]
componentsJoinedByString:@"\n"];
[userInfo setObject:description forKey:NSLocalizedDescriptionKey];
error = [NSError errorWithDomain:[error domain] code:[error code]
userInfo:userInfo];
[userInfo release];
This was sent by the SourceForge.net collaborative development platform, the
world's largest Open Source development site.
_______________________________________________
Skim-app-commit mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/skim-app-commit