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 {
[playlistView selectRowIndexes:[NSIndexSet indexSetWithIndex:pe.index] byExtendingSelection:NO];
}
@catch(id anException) {
@catch(NSException *e) {
}
}

View file

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

View file

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

View file

@ -969,15 +969,15 @@ static void *playlistControllerContext = &playlistControllerContext;
@try {
[super insertObjects:objects atArrangedObjectIndexes:indexes];
}
@catch(id anException) {
@catch(NSException *e) {
// Even further bodge fix
@try {
count = [[self arrangedObjects] count];
indexes = [NSMutableIndexSet indexSetWithIndexesInRange:NSMakeRange(count, [objects count])];
[super insertObjects:objects atArrangedObjectIndexes:indexes];
}
@catch(id anException) {
DLog(@"Exception thrown adding tracks to the playlist: %@", anException);
@catch(NSException *e) {
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];
}
@catch(id anException) {
DLog(@"Exception caught while processing path: %@", anException);
[SentrySDK captureException:anException];
@catch(NSException *e) {
DLog(@"Exception caught while processing path: %@", e);
[SentrySDK captureException:e];
[pathTask finishWithStatus:kSentrySpanStatusInternalError];
}
@ -518,9 +518,9 @@ static inline void dispatch_sync_reentrant(dispatch_queue_t queue, dispatch_bloc
pathTask = nil;
}
}
@catch(id anException) {
DLog(@"Exception caught while processing for containers: %@", anException);
[SentrySDK captureException:anException];
@catch(NSException *e) {
DLog(@"Exception caught while processing for containers: %@", e);
[SentrySDK captureException:e];
if(innerTask) {
[innerTask finishWithStatus:kSentrySpanStatusInternalError];
}
@ -600,9 +600,9 @@ static inline void dispatch_sync_reentrant(dispatch_queue_t queue, dispatch_bloc
[fileTask finish];
}
@catch(id anException) {
DLog(@"Exception caught while filtering paths: %@", anException);
[SentrySDK captureException:anException];
@catch(NSException *e) {
DLog(@"Exception caught while filtering paths: %@", e);
[SentrySDK captureException:e];
if(fileTask) {
[fileTask finishWithStatus:kSentrySpanStatusInternalError];
}
@ -657,9 +657,9 @@ static inline void dispatch_sync_reentrant(dispatch_queue_t queue, dispatch_bloc
[containedUrlTask finish];
}
@catch(id anException) {
DLog(@"Exception caught filtering contained URL: %@", anException);
[SentrySDK captureException:anException];
@catch(NSException *e) {
DLog(@"Exception caught filtering contained URL: %@", e);
[SentrySDK captureException:e];
if(containedUrlTask) {
[containedUrlTask finishWithStatus:kSentrySpanStatusInternalError];
}
@ -926,9 +926,9 @@ NSURL *_Nullable urlForPath(NSString *_Nullable path);
[childTask finish];
}
}
@catch(id anException) {
DLog(@"Exception thrown while reading tags: %@", anException);
[SentrySDK captureException:anException];
@catch(NSException *e) {
DLog(@"Exception thrown while reading tags: %@", e);
[SentrySDK captureException:e];
if(childTask) {
[childTask finishWithStatus:kSentrySpanStatusInternalError];
}
@ -1074,9 +1074,9 @@ NSURL *_Nullable urlForPath(NSString *_Nullable path);
[childTask finish];
}
}
@catch(id anException) {
DLog(@"Exception thrown while reading tag synchronously: %@", anException);
[SentrySDK captureException:anException];
@catch(NSException *e) {
DLog(@"Exception thrown while reading tag synchronously: %@", e);
[SentrySDK captureException:e];
if(childTask) {
[childTask finishWithStatus:kSentrySpanStatusInternalError];
}