https://www.namasteui.com/javascript-onerror-method-to-handle-error/
JavaScript onerror() method to handle error