Hi team,
I am quite new to nodejs.
I searched the issues and not found the same, hence come to create a new issue.
I already added on 'error' function, like this:
con.on('error', function(err){
console.log(err.code);
});
But whenever MySQL error happens like selecting non-exists table, my App always crashes.
select * from not_exists_table
/home/user/my-project/node_modules/mysql/lib/protocol/Parser.js:78
throw err; // Rethrow non-MySQL errors
^
Error:
ER_NO_SUCH_TABLE: Table 'my-database.not_exists_table' doesn't exist
Don't know how to make App don't crash when MySQL error happens.
Thanks,
HoHo
Hi @hohozhao can you share your Node.js code? It looks like you may have a throw error in your code, which is crashing your app.
Hi @dougwilson ,
Thanks for quick reply.
YOU ARE CORRECT!
I did use throw err, and thinking it just "throw" out error message and continue, but instead it dies.
Now I remove "throw err" and "use console.log(err)" and my App continues.
You can close this issues now. I am young to mysqljs but love it!
Cheers,
HoHo
Sequence.js is buggy! if table or data not found sequence cannot not return a stack!
The code is no checking it, therefore parser.js is exceptional.
Otherwise i not understand the logic on parser.js line 79, it's directly bypasing error statement!
Sequence.js
Buggy 115. if (err.stack.indexOf(LONG_STACK_DELIMITER) !== -1)
Correct 115. if (!err.stack || err.stack.indexOf(LONG_STACK_DELIMITER) !== -1)
Thanks.
Hi @numberend please feel free to submit a pull request. Be sure to include a new test that fails without your fix and passes with it :)
Most helpful comment
Hi @hohozhao can you share your Node.js code? It looks like you may have a
throw errorin your code, which is crashing your app.