Add error reporting through self.onerror.
Add a way to log messages, and use it in the fetch event.