Answer the question
In order to leave comments, you need to log in
How to catch all errors in an application if some functions are already wrapped in try ... catch?
What is the correct way to catch application errors in one place if some functions are already wrapped in try catch ?
Interested in both back and front.
Answer the question
In order to leave comments, you need to log in
There is a `catch` for this, call your function in it. Something like this:
https://jsfiddle.net/g9xwf42h/
function parseError(er) {
console.log(er);
}
try {
var a = "test";
alert(a.b.c);
} catch (er) {
parseError(er);
}
try {
var b = "test2";
alert(b.c.d);
} catch (er) {
parseError(er);
}
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question