try {
requestAnimationFrame(function re(){
re();
})}
catch (e){
console.log(e);
}
I tried above code in console, i
the thing about catching a maximum stack size exceeded error is I'm not sure how it would work. The only thing that the browser could do to allow the error to be caught is empty the stack then have the next function run be the catch function but at that point (and I don't think browsers can even get it that far) you would have no indication on where your code broke so anything you tried to run would be severely buggy at best.
Another problem (which is probably why no browsers have this) is because most functions you would run after the error would simply try to restart normal web function in some way. Since you don't know what broke you can't stop it from happening again so you would end up crashing it again and again. Which would make both the users and the browsers mad at your web page.
So I guess the best that can be done is make sure your code doesn't have infinity loops and is able to run smoothly
a good description of stack size and how it works can be found in the answer to this question