Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Exception thrown from SmallDateTime/generateParameterData cannot be caught properly #1265

Open
tidhar-ziv opened this issue May 20, 2021 · 1 comment · May be fixed by #1271
Open

Exception thrown from SmallDateTime/generateParameterData cannot be caught properly #1265

tidhar-ziv opened this issue May 20, 2021 · 1 comment · May be fixed by #1271

Comments

@tidhar-ziv
Copy link

This exception was thrown due to a query date parameter earlier than "1900/01/01":

RangeError [ERR_OUT_OF_RANGE]: The value of "value" is out of range. It must be >= 0 and <= 65535. Received -1
    at checkInt (internal/buffer.js:69:11)
    at writeU_Int16LE (internal/buffer.js:719:3)
    at Buffer.writeUInt16LE (internal/buffer.js:727:10)
    at Object.generateParameterData (C:\Users\i025052\projects\playground\node_modules\tedious\lib\data-types\smalldatetime.js:53:12)
    at generateParameterData.next (<anonymous>)
    at RpcRequestPayload.generateParameterData (C:\Users\i025052\projects\playground\node_modules\tedious\lib\rpcrequest-payload.js:114:17)
    at generateParameterData.next (<anonymous>)
    at RpcRequestPayload.generateData (C:\Users\i025052\projects\playground\node_modules\tedious\lib\rpcrequest-payload.js:68:19)
    at generateData.next (<anonymous>)
    at C:\Users\i025052\projects\playground\node_modules\readable-stream\lib\internal\streams\from.js:43:35 {
  code: 'ERR_OUT_OF_RANGE'
}

The problem is that this exception is thrown on the main thread, so the only way to catch it is in process.on("uncaughtException"), which practically means crashing the process

@IanChokS
Copy link
Member

@tidhar-ziv Thanks for raising this issue, we'll see if we can create a fix!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants