added exception handling to get_response_