Added handling for `onerror` to log on the `error` stream of the console by default, maybe not the best possible behavior, but good for starters. If you have a better idea for this, please change it accordingly.