better error handling in cryptoworker