Improve error response handling.