bindings/javascript: Improve error when prepare() called after close()

This commit is contained in:
Pekka Enberg
2025-08-06 07:48:15 +03:00
parent f6fb786cc9
commit 79412ea2cc
4 changed files with 19 additions and 0 deletions

View File

@@ -87,6 +87,10 @@ class Database {
* @param {string} sql - The SQL statement string to prepare.
*/
prepare(sql) {
if (!this.open) {
throw new TypeError("The database connection is not open");
}
if (!sql) {
throw new RangeError("The supplied SQL string contains no statements");
}