Connection is closed
Closed this issue · 2 comments
I'm using connect-mssql with Tedious in order to connect to an Azure DB.
When the connection is closed an unhandled exception is thrown:
ConnectionError: Connection is closed.
at /node_modules/mssql/lib/main.js:1487:17
at process._tickCallback (node.js:355:11)
I believe this should be catched and return an empty session and not causing the server to stop delivering the page.
This also happens if a request comes in before the connection has been established.
ConnectionError: Connection is closed.
at \connect-mssql\node_modules\mssql\lib\main.js:1489:17
at process._tickCallback (node.js:355:11)
This is because in mssql's main.js, it goes to Request._query(), but that fails because the connection is still connecting, so connection.connecetd is false, hence the error. Just a little bit later, the connection is established and future requests go through.
Is there a way for the store to wait until the connection is live before responding or attempting to run any queries?
Fixed in 1.5.0.