Skip to content

Errors in ConnectionError open do not provide details #1810

@gavinaiken

Description

@gavinaiken

If an error is encountered in open, it is recast into a ConnectionError here: https://github.com/tediousjs/node-mssql/blob/master/lib/msnodesqlv8/connection-pool.js#L46

However, the constructor for ConnectionError expects (message, code), not (error) so when the error then bubbles up to the calling code, it looks like this:

conn err: ConnectionError: [object Object]
    at PrivateConnection.callback2 (/Users/gavin/repos/node-core/collector/collector-server/node_modules/mssql/lib/msnodesqlv8/connection-pool.js:47:17)
    at Immediate._onImmediate (/Users/gavin/repos/node-core/collector/collector-server/node_modules/msnodesqlv8/lib/connection.js:47:14)
    at process.processImmediate (node:internal/timers:485:21) {
  code: undefined
}

I have a simple fix which I will provide a PR for.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions