You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
return new Promise((resolve, reject)=>{
var xhr = new XMLHttpRequest();
//xhr.overrideMimeType("application/json");
xhr.open("GET", "test", true);
xhr.onload = function(){
console.log(this.responseText);
resolve(this.responseText);
};
xhr.onerror = function(error){
console.log(this);
throw (error);
};
xhr.send();
})
Although the onerror function is triggered, the error object is undefined.
This is strange since the output of console.log(this) in the above code snippet demonstrates that the reason for the error is clearly known. The output is the following:
This issue can be recreated quite simply:
Although the
onerror
function is triggered, the error object isundefined
.This is strange since the output of
console.log(this)
in the above code snippet demonstrates that the reason for the error is clearly known. The output is the following:The text was updated successfully, but these errors were encountered: