diff --git a/src/js/internal/sql/mysql.ts b/src/js/internal/sql/mysql.ts index f41cb3c221..d9f025ee69 100644 --- a/src/js/internal/sql/mysql.ts +++ b/src/js/internal/sql/mysql.ts @@ -396,19 +396,13 @@ class PooledMySQLConnection { this.queryCount = 0; this.flags &= ~PooledConnectionFlags.reserved; - try { - // notify all queries that the connection is closed - for (const onClose of queries) { - onClose(err); - } - const onFinish = this.onFinish; - if (onFinish) { - onFinish(err); - } - } catch (e) { - console.log("onClose error", e, this instanceof PooledMySQLConnection, this, this.queries); - console.log("error", err); - throw e; + // notify all queries that the connection is closed + for (const onClose of queries) { + onClose(err); + } + const onFinish = this.onFinish; + if (onFinish) { + onFinish(err); } this.adapter.release(this, true); @@ -425,7 +419,7 @@ class PooledMySQLConnection { this.connection = await PooledMySQLConnection.createConnection( this.connectionInfo, this.#onConnected.bind(this), - this.#onClose.bind(this), + (...args) => this.#onClose(...args), ); }