Add ConnectionError and RequestError to module.exports #489

merged 1 commit into from Jan 12, 2017


None yet

3 participants


Unless I'm missing something, it seems that you can't easily instantiate a ConnectionError or RequestError with the current exports from tedious.js. I find that this makes it difficult to interrogate errors returned from the library, i.e. by using instanceof, such as in the following code:

tds.process(function(err, data) {
  if (err) {
    if (err instanceof ConnectionError) {
    } else if (err instanceof RequestError) {
  else {

It seems like exporting the error types would make it easier to write code like the above.

I'm relatively new to working with JavaScript, so it may be that there's a reason this isn't being done, or that this isn't actually necessary. My apologies if that's the case.

Jeff Rosenberg Add ConnectionError and RequestError to module.exports

Looks reasonable to me.

I'll give it a little time before I merge, to see if @arthurschreiber has other insights, which he usually does :-)


This is looking great, thanks! ❤️

@tvrprasad Feel free to merge anytime!

@tvrprasad tvrprasad merged commit d30e491 into tediousjs:master Jan 12, 2017

2 checks passed

continuous-integration/appveyor/pr AppVeyor build succeeded
continuous-integration/travis-ci/pr The Travis CI build passed

Thanks for the contribution :-)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment