Add back error handling when using as a web worker