Skip to content

Commit e1c35d1

Browse files
committed
fix: promise rejections with error
1 parent 67b4af3 commit e1c35d1

File tree

7 files changed

+12
-22
lines changed

7 files changed

+12
-22
lines changed

bun.lockb

480 Bytes
Binary file not shown.

example/ios/Podfile.lock

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1885,7 +1885,7 @@ SPEC CHECKSUMS:
18851885
fmt: 10c6e61f4be25dc963c36bd73fc7b1705fe975be
18861886
glog: 08b301085f15bcbb6ff8632a8ebaf239aae04e6a
18871887
hermes-engine: 46f1ffbf0297f4298862068dd4c274d4ac17a1fd
1888-
NitroModules: d98cdb1eb0e7e6e88093b9b47134b99a31a70471
1888+
NitroModules: 1431939cc88ada3a3da108d11a293725d93e14c8
18891889
RCT-Folly: bf5c0376ffe4dd2cf438dcf86db385df9fdce648
18901890
RCTDeprecation: fde92935b3caa6cb65cbff9fbb7d3a9867ffb259
18911891
RCTRequired: 75c6cee42d21c1530a6f204ba32ff57335d19007

example/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
"expo-status-bar": "^1.12.1",
2424
"react": "*",
2525
"react-native": "*",
26-
"react-native-nitro-modules": "*",
26+
"react-native-nitro-modules": "https://gitpkg.vercel.app/mrousavy/nitro/packages/react-native-nitro-modules?5334d8c902ea36d3f630be0c5b3e2e3ec5029661",
2727
"react-native-nitro-sqlite": "9.0.1",
2828
"react-native-safe-area-context": "^4.14.0",
2929
"react-native-screens": "^3.35.0",

example/src/tests/unitTests.spec.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -559,6 +559,8 @@ export function registerUnitTests() {
559559
await promised
560560
expect.fail('Should not resolve')
561561
} catch (e) {
562+
console.log(e)
563+
562564
if (isError(e))
563565
expect(e.message).to.include('no such table: tableThatDoesNotExist')
564566
else expect.fail('Should have thrown a valid NitroSQLiteException')

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@
3131
"patch-package": "^8.0.0",
3232
"react": "18.3.1",
3333
"react-native": "0.76.1",
34-
"react-native-nitro-modules": "^0.17.0"
34+
"react-native-nitro-modules": "https://gitpkg.vercel.app/mrousavy/nitro/packages/react-native-nitro-modules?5334d8c902ea36d3f630be0c5b3e2e3ec5029661"
3535
},
3636
"devDependencies": {
3737
"@babel/core": "^7.25.2",

package/cpp/specs/HybridNitroSQLite.cpp

Lines changed: 6 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -61,12 +61,8 @@ ExecuteQueryResult HybridNitroSQLite::execute(const std::string& dbName, const s
6161
std::shared_ptr<Promise<std::shared_ptr<HybridNativeQueryResultSpec>>> HybridNitroSQLite::executeAsync(const std::string& dbName, const std::string& query,
6262
const std::optional<SQLiteQueryParams>& params) {
6363
return Promise<std::shared_ptr<HybridNativeQueryResultSpec>>::async([=, this]() -> std::shared_ptr<HybridNativeQueryResultSpec> {
64-
try {
65-
auto result = execute(dbName, query, params);
66-
return result;
67-
} catch (...) {
68-
throw std::current_exception();
69-
}
64+
auto result = execute(dbName, query, params);
65+
return result;
7066
});
7167
};
7268

@@ -80,12 +76,8 @@ BatchQueryResult HybridNitroSQLite::executeBatch(const std::string& dbName, cons
8076
std::shared_ptr<Promise<BatchQueryResult>> HybridNitroSQLite::executeBatchAsync(const std::string& dbName,
8177
const std::vector<BatchQueryCommand>& batchParams) {
8278
return Promise<BatchQueryResult>::async([=, this]() -> BatchQueryResult {
83-
try {
84-
auto result = executeBatch(dbName, batchParams);
85-
return result;
86-
} catch (...) {
87-
throw std::current_exception();
88-
}
79+
auto result = executeBatch(dbName, batchParams);
80+
return result;
8981
});
9082
};
9183

@@ -96,12 +88,8 @@ FileLoadResult HybridNitroSQLite::loadFile(const std::string& dbName, const std:
9688

9789
std::shared_ptr<Promise<FileLoadResult>> HybridNitroSQLite::loadFileAsync(const std::string& dbName, const std::string& location) {
9890
return Promise<FileLoadResult>::async([=, this]() -> FileLoadResult {
99-
try {
100-
auto result = loadFile(dbName, location);
101-
return result;
102-
} catch (...) {
103-
throw std::current_exception();
104-
}
91+
auto result = loadFile(dbName, location);
92+
return result;
10593
});
10694
};
10795

package/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@
7474
"react": "*",
7575
"react-native": "*",
7676
"react-native-builder-bob": "^0.31.0",
77-
"react-native-nitro-modules": "*"
77+
"react-native-nitro-modules": "https://gitpkg.vercel.app/mrousavy/nitro/packages/react-native-nitro-modules?5334d8c902ea36d3f630be0c5b3e2e3ec5029661"
7878
},
7979
"peerDependencies": {
8080
"react": ">=17.0.0",

0 commit comments

Comments
 (0)