Skip to content

Commit c23a013

Browse files
committed
Catch errors thrown by new tds.Connection()
1 parent 6157a60 commit c23a013

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

lib/tedious/connection-pool.js

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,13 @@ class ConnectionPool extends BaseConnectionPool {
5959
payload: true
6060
}
6161
}
62-
const tedious = new tds.Connection(cfg)
62+
let tedious
63+
try {
64+
tedious = new tds.Connection(cfg)
65+
} catch (err) {
66+
rejectOnce(err)
67+
return
68+
}
6369
tedious.connect(err => {
6470
if (err) {
6571
err = new ConnectionError(err)

0 commit comments

Comments
 (0)