Skip to content

Commit fb6e064

Browse files
author
Oscar Franco
authored
Merge pull request #84 from VolkerLieber/patch-1
Throw JSError React Native version independent
2 parents d804aac + 9cf8fd9 commit fb6e064

File tree

1 file changed

+9
-9
lines changed

1 file changed

+9
-9
lines changed

cpp/installer.cpp

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ void install(jsi::Runtime &rt, std::shared_ptr<react::CallInvoker> jsCallInvoker
9595
}
9696
if (!args[0].isString() || !args[1].isString() || !args[2].isString())
9797
{
98-
jsi::detail::throwJSError(rt, "dbName, databaseToAttach and alias must be a strings");
98+
throw jsi::JSError(rt, "dbName, databaseToAttach and alias must be a strings");
9999
return {};
100100
}
101101

@@ -133,7 +133,7 @@ void install(jsi::Runtime &rt, std::shared_ptr<react::CallInvoker> jsCallInvoker
133133
}
134134
if (!args[0].isString() || !args[1].isString())
135135
{
136-
jsi::detail::throwJSError(rt, "dbName, databaseToAttach and alias must be a strings");
136+
throw jsi::JSError(rt, "dbName, databaseToAttach and alias must be a strings");
137137
return {};
138138
}
139139

@@ -288,21 +288,21 @@ void install(jsi::Runtime &rt, std::shared_ptr<react::CallInvoker> jsCallInvoker
288288
{
289289
if (sizeof(args) < 3)
290290
{
291-
jsi::detail::throwJSError(rt, "[react-native-quick-sqlite][asyncExecuteSqlBatch] Incorrect parameter count");
291+
throw jsi::JSError(rt, "[react-native-quick-sqlite][asyncExecuteSqlBatch] Incorrect parameter count");
292292
return {};
293293
}
294294

295295
const jsi::Value &params = args[1];
296296
const jsi::Value &callbackHolder = args[2];
297297
if (!callbackHolder.isObject() || !callbackHolder.asObject(rt).isFunction(rt))
298298
{
299-
jsi::detail::throwJSError(rt, "[react-native-quick-sqlite][asyncExecuteSqlBatch] The callback argument must be a function");
299+
throw jsi::JSError(rt, "[react-native-quick-sqlite][asyncExecuteSqlBatch] The callback argument must be a function");
300300
return {};
301301
}
302302

303303
if (params.isNull() || params.isUndefined())
304304
{
305-
jsi::detail::throwJSError(rt, "[react-native-quick-sqlite][asyncExecuteSqlBatch] - An array of SQL commands or parameters is needed");
305+
throw jsi::JSError(rt, "[react-native-quick-sqlite][asyncExecuteSqlBatch] - An array of SQL commands or parameters is needed");
306306
return {};
307307
}
308308

@@ -377,14 +377,14 @@ void install(jsi::Runtime &rt, std::shared_ptr<react::CallInvoker> jsCallInvoker
377377
{
378378
if (sizeof(args) < 3)
379379
{
380-
jsi::detail::throwJSError(rt, "[react-native-quick-sqlite][asyncLoadSqlFile] Incorrect parameter count");
380+
throw jsi::JSError(rt, "[react-native-quick-sqlite][asyncLoadSqlFile] Incorrect parameter count");
381381
return {};
382382
}
383383

384384
const jsi::Value &callbackHolder = args[2];
385385
if (!callbackHolder.isObject() || !callbackHolder.asObject(rt).isFunction(rt))
386386
{
387-
jsi::detail::throwJSError(rt, "[react-native-quick-sqlite][asyncLoadSqlFile] The callback argument must be a function");
387+
throw jsi::JSError(rt, "[react-native-quick-sqlite][asyncLoadSqlFile] The callback argument must be a function");
388388
return {};
389389
}
390390

@@ -434,14 +434,14 @@ void install(jsi::Runtime &rt, std::shared_ptr<react::CallInvoker> jsCallInvoker
434434
{
435435
if (count < 4)
436436
{
437-
jsi::detail::throwJSError(rt, "[react-native-quick-sqlite][asyncExecuteSql] Incorrect arguments for asyncExecuteSQL");
437+
throw jsi::JSError(rt, "[react-native-quick-sqlite][asyncExecuteSql] Incorrect arguments for asyncExecuteSQL");
438438
return {};
439439
}
440440

441441
const jsi::Value &callbackHolder = args[3];
442442
if (!callbackHolder.isObject() || !callbackHolder.asObject(rt).isFunction(rt))
443443
{
444-
jsi::detail::throwJSError(rt, "[react-native-quick-sqlite][asyncExecuteSql] The callback argument must be a function");
444+
throw jsi::JSError(rt, "[react-native-quick-sqlite][asyncExecuteSql] The callback argument must be a function");
445445
return {};
446446
}
447447

0 commit comments

Comments
 (0)