I created a command line app in node.js which heavily relies on file system module of node (read, update, create new file etc). I write many functions for the same purpose.
Now my question is : 'Can I globally catch the error that occurred due to any function?'
For example:
func1(); // throws some error: Cannot find file , errCode:xyz
func2(); // throws some error: Cannot find file , errCode:xyz
//some global error catcher
func(catch errCode:xyz){
console.log("Cannot find file. Make sure file exist and path is correct.");
}
ss