Skip to content

Commit b9c151d

Browse files
committed
Add POOL_CONNLIMIT code to "No connections available." error
closes mysqljs#1332
1 parent 0d18e59 commit b9c151d

File tree

3 files changed

+8
-2
lines changed

3 files changed

+8
-2
lines changed

Changes.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,10 @@ This file is a manually maintained list of changes for each release. Feel free
44
to add your changes here when sending pull requests. Also send corrections if
55
you spot any mistakes.
66

7+
## HEAD
8+
9+
* Add `POOL_CONNLIMIT` code to "No connections available." error #1332
10+
711
## v2.10.2 (2016-01-12)
812

913
* Fix exception/hang from certain SSL connection errors #1153

lib/Pool.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,9 @@ Pool.prototype.getConnection = function (cb) {
6262

6363
if (!this.config.waitForConnections) {
6464
return process.nextTick(function(){
65-
return cb(new Error('No connections available.'));
65+
var err = new Error('No connections available.');
66+
err.code = 'POOL_CONNLIMIT';
67+
cb(err);
6668
});
6769
}
6870

test/unit/pool/test-connection-limit-no-wait.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,8 @@ server.listen(common.fakeServerPort, function(err){
1717

1818
pool.getConnection(function (err) {
1919
assert.ok(err);
20-
assert.equal(err.fatal);
2120
assert.equal(err.message, 'No connections available.');
21+
assert.equal(err.code, 'POOL_CONNLIMIT');
2222

2323
connection.destroy();
2424
server.destroy();

0 commit comments

Comments
 (0)