Bug Fix: Correct exception handling blocks

These should be catching NSException*, not generic `id`.

Signed-off-by: Christopher Snowhill <kode54@gmail.com>
This commit is contained in:
Christopher Snowhill 2025-03-05 15:24:10 -08:00
parent 93bec8ca63
commit 3d574ba187
5 changed files with 25 additions and 25 deletions

View file

@ -888,7 +888,7 @@ static BOOL consentLastEnabled = NO;
@try { @try {
[playlistView selectRowIndexes:[NSIndexSet indexSetWithIndex:pe.index] byExtendingSelection:NO]; [playlistView selectRowIndexes:[NSIndexSet indexSetWithIndex:pe.index] byExtendingSelection:NO];
} }
@catch(id anException) { @catch(NSException *e) {
} }
} }

View file

@ -422,8 +422,8 @@
} }
} }
} }
@catch(id anException) { @catch(NSException *e) {
DLog(@"Exception thrown checking file match: %@", anException); DLog(@"Exception thrown checking file match: %@", e);
} }
} }

View file

@ -111,7 +111,7 @@ static NSString *guess_encoding_of_string(const char *input) {
@try { @try {
ret = [NSString stringWithUTF8String:input]; ret = [NSString stringWithUTF8String:input];
} }
@catch(id anException) { @catch(NSException *e) {
// This method is incredibly slow // This method is incredibly slow
NSData *stringData = [NSData dataWithBytes:input length:strlen(input)]; NSData *stringData = [NSData dataWithBytes:input length:strlen(input)];
[NSString stringEncodingForData:stringData encodingOptions:nil convertedString:&ret usedLossyConversion:nil]; [NSString stringEncodingForData:stringData encodingOptions:nil convertedString:&ret usedLossyConversion:nil];

View file

@ -969,15 +969,15 @@ static void *playlistControllerContext = &playlistControllerContext;
@try { @try {
[super insertObjects:objects atArrangedObjectIndexes:indexes]; [super insertObjects:objects atArrangedObjectIndexes:indexes];
} }
@catch(id anException) { @catch(NSException *e) {
// Even further bodge fix // Even further bodge fix
@try { @try {
count = [[self arrangedObjects] count]; count = [[self arrangedObjects] count];
indexes = [NSMutableIndexSet indexSetWithIndexesInRange:NSMakeRange(count, [objects count])]; indexes = [NSMutableIndexSet indexSetWithIndexesInRange:NSMakeRange(count, [objects count])];
[super insertObjects:objects atArrangedObjectIndexes:indexes]; [super insertObjects:objects atArrangedObjectIndexes:indexes];
} }
@catch(id anException) { @catch(NSException *e) {
DLog(@"Exception thrown adding tracks to the playlist: %@", anException); DLog(@"Exception thrown adding tracks to the playlist: %@", e);
} }
} }

View file

@ -402,9 +402,9 @@ static inline void dispatch_sync_reentrant(dispatch_queue_t queue, dispatch_bloc
[pathTask finish]; [pathTask finish];
} }
@catch(id anException) { @catch(NSException *e) {
DLog(@"Exception caught while processing path: %@", anException); DLog(@"Exception caught while processing path: %@", e);
[SentrySDK captureException:anException]; [SentrySDK captureException:e];
[pathTask finishWithStatus:kSentrySpanStatusInternalError]; [pathTask finishWithStatus:kSentrySpanStatusInternalError];
} }
@ -518,9 +518,9 @@ static inline void dispatch_sync_reentrant(dispatch_queue_t queue, dispatch_bloc
pathTask = nil; pathTask = nil;
} }
} }
@catch(id anException) { @catch(NSException *e) {
DLog(@"Exception caught while processing for containers: %@", anException); DLog(@"Exception caught while processing for containers: %@", e);
[SentrySDK captureException:anException]; [SentrySDK captureException:e];
if(innerTask) { if(innerTask) {
[innerTask finishWithStatus:kSentrySpanStatusInternalError]; [innerTask finishWithStatus:kSentrySpanStatusInternalError];
} }
@ -600,9 +600,9 @@ static inline void dispatch_sync_reentrant(dispatch_queue_t queue, dispatch_bloc
[fileTask finish]; [fileTask finish];
} }
@catch(id anException) { @catch(NSException *e) {
DLog(@"Exception caught while filtering paths: %@", anException); DLog(@"Exception caught while filtering paths: %@", e);
[SentrySDK captureException:anException]; [SentrySDK captureException:e];
if(fileTask) { if(fileTask) {
[fileTask finishWithStatus:kSentrySpanStatusInternalError]; [fileTask finishWithStatus:kSentrySpanStatusInternalError];
} }
@ -657,9 +657,9 @@ static inline void dispatch_sync_reentrant(dispatch_queue_t queue, dispatch_bloc
[containedUrlTask finish]; [containedUrlTask finish];
} }
@catch(id anException) { @catch(NSException *e) {
DLog(@"Exception caught filtering contained URL: %@", anException); DLog(@"Exception caught filtering contained URL: %@", e);
[SentrySDK captureException:anException]; [SentrySDK captureException:e];
if(containedUrlTask) { if(containedUrlTask) {
[containedUrlTask finishWithStatus:kSentrySpanStatusInternalError]; [containedUrlTask finishWithStatus:kSentrySpanStatusInternalError];
} }
@ -926,9 +926,9 @@ NSURL *_Nullable urlForPath(NSString *_Nullable path);
[childTask finish]; [childTask finish];
} }
} }
@catch(id anException) { @catch(NSException *e) {
DLog(@"Exception thrown while reading tags: %@", anException); DLog(@"Exception thrown while reading tags: %@", e);
[SentrySDK captureException:anException]; [SentrySDK captureException:e];
if(childTask) { if(childTask) {
[childTask finishWithStatus:kSentrySpanStatusInternalError]; [childTask finishWithStatus:kSentrySpanStatusInternalError];
} }
@ -1074,9 +1074,9 @@ NSURL *_Nullable urlForPath(NSString *_Nullable path);
[childTask finish]; [childTask finish];
} }
} }
@catch(id anException) { @catch(NSException *e) {
DLog(@"Exception thrown while reading tag synchronously: %@", anException); DLog(@"Exception thrown while reading tag synchronously: %@", e);
[SentrySDK captureException:anException]; [SentrySDK captureException:e];
if(childTask) { if(childTask) {
[childTask finishWithStatus:kSentrySpanStatusInternalError]; [childTask finishWithStatus:kSentrySpanStatusInternalError];
} }