Relative Content

Tag Archive for node.jsapiexpressnode-modules

How can i catch an error in node.js using wrapper function?

I am using an AsyncHandler wrapper function to catch my errors in my controller and service layer.
I am using next() parameter to raise an error, and then catch it in my global error handler.
My global error handler is executing but my controller is also returning, even tho it should haven’t return anything after error is thrown.
My Controller layer: