Generalized error handling.