For error reporting, I would like to insert a try-catch wrapper around the code of every function I have.
So basically I want to replace
function foo(ar
I wonder (this is pure speculation, so not sure if this would work) you could do something like this:
function callTryCatch(functionSignature) {
try {
eval(functionSignature);
} catch (e) {
customErrorHandler(e);
}
}
function entryPoint() {
callTryCatch(function() {
// do function logic
});
}
Again, this is pure speculation and I haven't tested but if it's even possible I think the key lies in the eval statement.