This is not a great solution. Any suggestions how to go around `script.onerror` better?