Skip to content

Commit

Permalink
Merge pull request #1592 from bombjackit/patch-acquire
Browse files Browse the repository at this point in the history
_acquire in case of reject return a promise, if this._acquire.promise is used in acquire, in case of reject an exception is raised that is not "captured" by the catch
  • Loading branch information
dhensby committed Jan 16, 2024
2 parents 1d8a2f4 + 55f5a9f commit f09c23d
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions lib/base/connection-pool.js
Original file line number Diff line number Diff line change
Expand Up @@ -363,7 +363,7 @@ class ConnectionPool extends EventEmitter {
*/

acquire (requester, callback) {
const acquirePromise = shared.Promise.resolve(this._acquire().promise).catch(err => {
const acquirePromise = shared.Promise.resolve(this._acquire()).catch(err => {
this.emit('error', err)
throw err
})
Expand All @@ -382,7 +382,7 @@ class ConnectionPool extends EventEmitter {
return shared.Promise.reject(new ConnectionError('Connection is closing', 'ENOTOPEN'))
}

return this.pool.acquire()
return this.pool.acquire().promise
}

/**
Expand Down

0 comments on commit f09c23d

Please sign in to comment.