Skip to content


Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP


Error returned from .query is malformed #106

carnedv opened this Issue · 6 comments

3 participants


I'm using the development branch and cannot log the error message on failed .query calls because the error message is malformed.


{ [Error: [Microsoft][SQL Server Native Client 10.0][SQL Server]Violation of PRIMARY KEY constraint 'PK_Foo'. Cannot insert duplicate key in object 'dbo.Foo'.] sqlstate: '23000', code: 2627 }

sqlstate and code are retrievable as valid object properties, but the error message is not assigned to a property nor quoted to be a string, making it irretrievable/unusable.

To reproduce: using development branch, submit a .query that fails, then view err parameter in callback.


Is there a reason that you're not using the master branch? I'm not sure the problem isn't on that branch too, but that is now the preferred branch for new development.


I switched to development because master was not catching the error at all, just outputting a string to stdout. Might also have had an issue compiling it on my machine. I'll try to recompile the most recent master and see what it does and report back.


Was able to manually build the latest master and switched to using it. Same behavior that I initially reported was still observed. Also, on a different INSERT query I also got the err parameter returned as boolean 'true' without an uncaught exception. I can take the time to trace where each of those failed if it would be beneficial.


If you desire to trace it, by all means, please do so. If you do fix it, please see for guidelines on how to submit your fix.

If you prefer, some sample code would go a long way to helping me find the error(s) and fixing them.



FWIW, I can reproduce the err parameter coming back a simple boolean true by passing an array parameter to the query where it expects a string:

  sql.queryRaw(conn_str, "INSERT INTO foo (nvarchar_type_col) VALUES (?)",
    [["array not string"]],
    function(err) { console.log(util.inspect(err)); }

Thanks. I will look into it as soon as I can. I just returned from a lengthy out of town trip.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.