Error handling in doc