Smarter error handling.