Sails global adapter - catch errors leading to server failure

I am trying to find a better place to handle connection errors or any other global errors that cause the server to crash.

What is the best place to catch adapters / global errors and not cause them to fail?

In particular, I want to handle these types of errors in a graceful way:

Error spawning mySQL connection:
error: Hook failed to load: orm (Error: connect ECONNREFUSED)
error: Error encountered while loading Sails core!
error: Error: connect ECONNREFUSED
+4
source share
1 answer

from sailing documents: http://sailsjs.org/#!documentation/config.500

thats handling canvas error handling from inside the config

if your error goes away, you can connect there, otherwise you can connect to the node process

process.on('uncaughtException', function (err) {
  if (err.toString() === 'Error spawning mySQL connection') {
    //rende some error page
  }
})

async, -

, , , ( ) -

module.exports, , , . ,

+3

All Articles