fixed using
if (property_exists($http_result, 'error')) {