'Node Mysql is breaking node app entirely

For some reason, my node app (specifically the node module) is getting a "Too many connections" error that I can't figure out what is actually causing it, but rather than handling the error it's completely crashing the app.

To give you an idea of what this looks like:

/node_modules/mysql/lib/protocol/sequences/Sequence.js:52
  var err  = new Error(code + ': ' + packet.message);
             ^
Error: ER_CON_COUNT_ERROR: Too many connections

What is the best way to handle this so it is not actually killing the app?

This is when running npm run dev.



Solution 1:[1]

I solved an issue related to this using

try{

}
catch (e){

}

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 cigien