- with_error_handling(EH_THROW, php_http_exception_class_entry) {
- if (SUCCESS == zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "O", &request, php_http_client_request_class_entry)) {
- php_http_client_object_t *obj = zend_object_store_get_object(getThis() TSRMLS_CC);
- php_http_message_object_t *req_obj = zend_object_store_get_object(request TSRMLS_CC);
- php_http_client_progress_state_t *progress;
-
- if (SUCCESS == php_http_client_getopt(obj->client, PHP_HTTP_CLIENT_OPT_PROGRESS_INFO, req_obj->message, &progress)) {
- object_init(return_value);
- add_property_bool(return_value, "started", progress->started);
- add_property_bool(return_value, "finished", progress->finished);
- add_property_string(return_value, "info", STR_PTR(progress->info), 1);
- add_property_double(return_value, "dltotal", progress->dl.total);
- add_property_double(return_value, "dlnow", progress->dl.now);
- add_property_double(return_value, "ultotal", progress->ul.total);
- add_property_double(return_value, "ulnow", progress->ul.now);
- }
- }
- } end_error_handling();
+ php_http_expect(SUCCESS == zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "O", &request, php_http_client_request_class_entry), invalid_arg, return);
+
+ obj = zend_object_store_get_object(getThis() TSRMLS_CC);
+ req_obj = zend_object_store_get_object(request TSRMLS_CC);
+
+ php_http_expect(SUCCESS == php_http_client_getopt(obj->client, PHP_HTTP_CLIENT_OPT_PROGRESS_INFO, req_obj->message, &progress), unexpected_val, return);
+
+ object_init(return_value);
+ add_property_bool(return_value, "started", progress->started);
+ add_property_bool(return_value, "finished", progress->finished);
+ add_property_string(return_value, "info", STR_PTR(progress->info), 1);
+ add_property_double(return_value, "dltotal", progress->dl.total);
+ add_property_double(return_value, "dlnow", progress->dl.now);
+ add_property_double(return_value, "ultotal", progress->ul.total);
+ add_property_double(return_value, "ulnow", progress->ul.now);