8

I just switched my node api over to use node-mysql. It keeps suppressing my errors/stack traces making development and debugging a nightmare. For example, I am writing a new feature and I get this error:

/opt/figo/banking/node_modules/mysql/lib/protocol/Parser.js:78
    throw err; // Rethrow non-MySQL errors
          ^
TypeError: string is not a function

The mysql module is essential re-wording my original error messages. How can I get it to stop doing this? I want to just see exactly where it failed, not where node-mysql decided to rethrow my error.

Jeremy
  • 1,717
  • 5
  • 30
  • 49
  • Maybe your error messages are strings and it's expecting them to be `Error`s so they are not logged properly when rethrown – Explosion Pills May 02 '16 at 15:25
  • The code is crashing, I'm not intentionally throwing an error. Here is the conditional in Parser.js:78 `if (!err || typeof err.code !== 'string' || err.code.substr(0, 7) !== 'PARSER_') throw err;` – Jeremy May 02 '16 at 15:56

2 Answers2

0

If you are throwing error it should a valid error object.I think you are throwing string.Try this

throw new Error("oops something happened");
Arun Killu
  • 13,581
  • 5
  • 34
  • 61
0

you are passing string instead of int or int instead of string

what i mean is, you are passing value using wrong data type. not to mysql but to other function, check step by step.

check what data type of var you are passing using

console.log(typeof(yourVar));