Hey all, I would like to know your thoughts on our internal discussion.<p>We are trying to establish a error handling framework.<p>My peer came up with this simple POC. The idea is that this function will reduce amount of try catch used in the business logic.<p>---<p>function errorHandler(func, ...params) {
try {
return func(params)
} catch (e) {
console.log('error on function ${func}`)
throw e;
}
}<p>errorHandler(fetch, 'api url')
---<p>But I think it is not a good idea to have a generic handler like this and it is ok to have try catch for each function.<p>My question- is the above handler is ok or is there any better way to handle errors? Your input is greatly appreciated.