Add intelligent error handling.