Improve window.onerror handler

* Try to extract the error name from the message
* Bugfix: file and line number were not being reported