Error handling in response handler