wrap worker to handle errors