diff --git a/src/js/internal/sql/mysql.ts b/src/js/internal/sql/mysql.ts index 8e4702944e..f41cb3c221 100644 --- a/src/js/internal/sql/mysql.ts +++ b/src/js/internal/sql/mysql.ts @@ -396,13 +396,19 @@ class PooledMySQLConnection { this.queryCount = 0; this.flags &= ~PooledConnectionFlags.reserved; - // notify all queries that the connection is closed - for (const onClose of queries) { - onClose(err); - } - const onFinish = this.onFinish; - if (onFinish) { - onFinish(err); + 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; } this.adapter.release(this, true);