the code below will not trigger window.onerror, despite json() failing because the endpoint did not return valid json, and nobody is catching the error, so why isn't window.onerror invoked? jsfiddle: https://jsfiddle.net/f287sn05/
code:
window.onerror=function(error){
alert("errorhandler 1: "+error);
}
if(1){
window.addEventListener("error",function(error){
alert("errorhandler 2: "+error);
});
}
(async function(){
let foo= ((await ( await fetch("/no_json_plz_i_want_an_error")).json()));
})();