error handling for dopar