js detect all images errors

JavaScript
window.addEventListener("error", e => {
  /* query selector images */
  // image element on error => replace source 
})
Source

Also in JavaScript: