Skip to content

Commit

Permalink
fix(ios): guard and re-throw native exception (#13875)
Browse files Browse the repository at this point in the history
  • Loading branch information
hansemannn committed Jun 28, 2023
1 parent 0d27497 commit 9308d2b
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion iphone/Classes/TiDatabaseProxy.m
Original file line number Diff line number Diff line change
Expand Up @@ -266,7 +266,15 @@ - (TiDatabaseResultSetProxy *)execute:(NSString *)sql
}

NSError *error = nil;
TiDatabaseResultSetProxy *result = [self executeSQL:sql withParams:params withError:&error];
TiDatabaseResultSetProxy *result = nil;

// Guard the native exception and re-throw, so it can be caught on the JavaScript side
@try {
result = [self executeSQL:sql withParams:params withError:&error];
} @catch (NSException *exception) {
[self throwException:@"failed to execute SQL statement" subreason:[error description] location:CODELOCATION];
}

if (error != nil) {
[self throwException:@"failed to execute SQL statement" subreason:[error description] location:CODELOCATION];
return nil;
Expand Down

0 comments on commit 9308d2b

Please sign in to comment.