lets consider the code below, is there any way to get the original error thrown by suppressor(), using Proxy or Reflection or decorators (from typescript) or node event emitter?
PS: I don't want to inject a probe in suppressor(), means I don't want to modify the suppressor function. Actually I want to add logging and don't want add probe in every try-catch
function suppressor() {
try {
throw Error('original error')
} catch (e){
throw Error ('suppressed Error')
}
}
try {
suppressor()
} catch(e) {
// can we get the original error thrown by suppressor() here. i.e can i get 'original error'
console.log(e) // 'suppressed Error'
}
Aucun commentaire:
Enregistrer un commentaire