Skip to content

Commit 6760ae1

Browse files
authored
Merge pull request #1 from and3k5/custom-version
Custom version
2 parents cc455f7 + 176ec7c commit 6760ae1

File tree

4 files changed

+12
-37
lines changed

4 files changed

+12
-37
lines changed

.github/workflows/CI.yml

Lines changed: 0 additions & 25 deletions
This file was deleted.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
2-
"name": "sql.js",
2+
"name": "@and3k5/sql.js",
33
"version": "1.7.0",
44
"description": "SQLite library with support for opening and writing databases, prepared statements, and more. This SQLite library is in pure javascript (compiled with emscripten).",
55
"keywords": [

src/api.js

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -311,11 +311,11 @@ Module["onRuntimeInitialized"] = function onRuntimeInitialized() {
311311
312312
* @param {Statement.BindParams} values The values to bind
313313
* @return {boolean} true if it worked
314-
* @throws {String} SQLite Error
314+
* @throws {Error} SQLite Error
315315
*/
316316
Statement.prototype["bind"] = function bind(values) {
317317
if (!this.stmt) {
318-
throw "Statement closed";
318+
throw new Error("Statement closed");
319319
}
320320
this["reset"]();
321321
if (Array.isArray(values)) return this.bindFromArray(values);
@@ -329,11 +329,11 @@ Module["onRuntimeInitialized"] = function onRuntimeInitialized() {
329329
that can be retrieved with {@link Statement.get}.
330330
331331
@return {boolean} true if a row of result available
332-
@throws {String} SQLite Error
332+
@throws {Error} SQLite Error
333333
*/
334334
Statement.prototype["step"] = function step() {
335335
if (!this.stmt) {
336-
throw "Statement closed";
336+
throw new Error("Statement closed");
337337
}
338338
this.pos = 1;
339339
var ret = sqlite3_step(this.stmt);
@@ -606,7 +606,7 @@ Module["onRuntimeInitialized"] = function onRuntimeInitialized() {
606606
default:
607607
break;
608608
}
609-
throw (
609+
throw new Error(
610610
"Wrong API use : tried to bind a value of an unknown type ("
611611
+ val + ")."
612612
);
@@ -738,7 +738,7 @@ Module["onRuntimeInitialized"] = function onRuntimeInitialized() {
738738

739739
/** Prepare the next available SQL statement
740740
@return {StatementIterator.StatementIteratorResult}
741-
@throws {String} SQLite error or invalid iterator error
741+
@throws {Error} SQLite error or invalid iterator error
742742
*/
743743
StatementIterator.prototype["next"] = function next() {
744744
if (this.sqlPtr === null) {
@@ -847,7 +847,7 @@ Module["onRuntimeInitialized"] = function onRuntimeInitialized() {
847847
*/
848848
Database.prototype["run"] = function run(sql, params) {
849849
if (!this.db) {
850-
throw "Database closed";
850+
throw new Error("Database closed");
851851
}
852852
if (params) {
853853
var stmt = this["prepare"](sql, params);
@@ -930,7 +930,7 @@ Module["onRuntimeInitialized"] = function onRuntimeInitialized() {
930930
*/
931931
Database.prototype["exec"] = function exec(sql, params, config) {
932932
if (!this.db) {
933-
throw "Database closed";
933+
throw new Error("Database closed");
934934
}
935935
var stack = stackSave();
936936
var stmt = null;
@@ -1028,15 +1028,15 @@ Module["onRuntimeInitialized"] = function onRuntimeInitialized() {
10281028
(`?`, `:VVV`, `:AAA`, `@AAA`)
10291029
@param {Statement.BindParams} [params] values to bind to placeholders
10301030
@return {Statement} the resulting statement
1031-
@throws {String} SQLite error
1031+
@throws {Error} SQLite error
10321032
*/
10331033
Database.prototype["prepare"] = function prepare(sql, params) {
10341034
setValue(apiTemp, 0, "i32");
10351035
this.handleError(sqlite3_prepare_v2(this.db, sql, -1, apiTemp, NULL));
10361036
// pointer to a statement, or null
10371037
var pStmt = getValue(apiTemp, "i32");
10381038
if (pStmt === NULL) {
1039-
throw "Nothing to prepare";
1039+
throw new Error("Nothing to prepare");
10401040
}
10411041
var stmt = new Statement(pStmt, this);
10421042
if (params != null) {

src/worker.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ function onModuleReady(SQL) {
2929
createDb();
3030
}
3131
if (!data["sql"]) {
32-
throw "exec: Missing query string";
32+
throw new Error("exec: Missing query string");
3333
}
3434
return postMessage({
3535
id: data["id"],

0 commit comments

Comments
 (0)