XHR "error" event listener not working when URL is wrong. Confused as to why

Working through Colt Steele's JavaScript course, and learning about XHR. This snippet is supposed to throw an error when the URL isn't correct. If I type gibberish like
/planetiuhnuoidhfugn/
it still works/I'm not seeing an error in Chrome DevTools. It'll throw the error if I change "swapi" to "swap" or "dev" to "co" as "swapi.co" no longer exists:
const firstReq = new XMLHttpRequest();
firstReq.addEventListener("load", function () {
  console.log("IT WORKED!!!");
});
firstReq.addEventListener("error", () => {
  console.log("ERROR!!!!!!");
});
firstReq.open("GET", "https://swapi.dev/api/planets/");
firstReq.send();
console.log("Request Sent!");
Was this page helpful?