@@ -311,11 +311,11 @@ Module["onRuntimeInitialized"] = function onRuntimeInitialized() {
311
311
312
312
* @param {Statement.BindParams } values The values to bind
313
313
* @return {boolean } true if it worked
314
- * @throws {String } SQLite Error
314
+ * @throws {Error } SQLite Error
315
315
*/
316
316
Statement . prototype [ "bind" ] = function bind ( values ) {
317
317
if ( ! this . stmt ) {
318
- throw "Statement closed" ;
318
+ throw new Error ( "Statement closed" ) ;
319
319
}
320
320
this [ "reset" ] ( ) ;
321
321
if ( Array . isArray ( values ) ) return this . bindFromArray ( values ) ;
@@ -329,11 +329,11 @@ Module["onRuntimeInitialized"] = function onRuntimeInitialized() {
329
329
that can be retrieved with {@link Statement.get}.
330
330
331
331
@return {boolean } true if a row of result available
332
- @throws {String } SQLite Error
332
+ @throws {Error } SQLite Error
333
333
*/
334
334
Statement . prototype [ "step" ] = function step ( ) {
335
335
if ( ! this . stmt ) {
336
- throw "Statement closed" ;
336
+ throw new Error ( "Statement closed" ) ;
337
337
}
338
338
this . pos = 1 ;
339
339
var ret = sqlite3_step ( this . stmt ) ;
@@ -606,7 +606,7 @@ Module["onRuntimeInitialized"] = function onRuntimeInitialized() {
606
606
default :
607
607
break ;
608
608
}
609
- throw (
609
+ throw new Error (
610
610
"Wrong API use : tried to bind a value of an unknown type ("
611
611
+ val + ")."
612
612
) ;
@@ -738,7 +738,7 @@ Module["onRuntimeInitialized"] = function onRuntimeInitialized() {
738
738
739
739
/** Prepare the next available SQL statement
740
740
@return {StatementIterator.StatementIteratorResult }
741
- @throws {String } SQLite error or invalid iterator error
741
+ @throws {Error } SQLite error or invalid iterator error
742
742
*/
743
743
StatementIterator . prototype [ "next" ] = function next ( ) {
744
744
if ( this . sqlPtr === null ) {
@@ -847,7 +847,7 @@ Module["onRuntimeInitialized"] = function onRuntimeInitialized() {
847
847
*/
848
848
Database . prototype [ "run" ] = function run ( sql , params ) {
849
849
if ( ! this . db ) {
850
- throw "Database closed" ;
850
+ throw new Error ( "Database closed" ) ;
851
851
}
852
852
if ( params ) {
853
853
var stmt = this [ "prepare" ] ( sql , params ) ;
@@ -930,7 +930,7 @@ Module["onRuntimeInitialized"] = function onRuntimeInitialized() {
930
930
*/
931
931
Database . prototype [ "exec" ] = function exec ( sql , params , config ) {
932
932
if ( ! this . db ) {
933
- throw "Database closed" ;
933
+ throw new Error ( "Database closed" ) ;
934
934
}
935
935
var stack = stackSave ( ) ;
936
936
var stmt = null ;
@@ -1028,15 +1028,15 @@ Module["onRuntimeInitialized"] = function onRuntimeInitialized() {
1028
1028
(`?`, `:VVV`, `:AAA`, `@AAA`)
1029
1029
@param {Statement.BindParams } [params] values to bind to placeholders
1030
1030
@return {Statement } the resulting statement
1031
- @throws {String } SQLite error
1031
+ @throws {Error } SQLite error
1032
1032
*/
1033
1033
Database . prototype [ "prepare" ] = function prepare ( sql , params ) {
1034
1034
setValue ( apiTemp , 0 , "i32" ) ;
1035
1035
this . handleError ( sqlite3_prepare_v2 ( this . db , sql , - 1 , apiTemp , NULL ) ) ;
1036
1036
// pointer to a statement, or null
1037
1037
var pStmt = getValue ( apiTemp , "i32" ) ;
1038
1038
if ( pStmt === NULL ) {
1039
- throw "Nothing to prepare" ;
1039
+ throw new Error ( "Nothing to prepare" ) ;
1040
1040
}
1041
1041
var stmt = new Statement ( pStmt , this ) ;
1042
1042
if ( params != null ) {
0 commit comments