(span: &mut impl HandleSpanObject, ch: &ZVal)
| 433 | } |
| 434 | |
| 435 | fn finish_exit_span(span: &mut impl HandleSpanObject, ch: &ZVal) -> crate::Result<()> { |
| 436 | let result = call("curl_getinfo", &mut [ch.clone()])?; |
| 437 | let response = result.as_z_arr().context("response in not arr")?; |
| 438 | let http_code = response |
| 439 | .get("http_code") |
| 440 | .and_then(|code| code.as_long()) |
| 441 | .context("Call curl_getinfo, http_code is null")?; |
| 442 | span.add_tag("status_code", &*http_code.to_string()); |
| 443 | |
| 444 | if http_code == 0 { |
| 445 | let result = call("curl_error", &mut [ch.clone()])?; |
| 446 | let curl_error = result |
| 447 | .as_z_str() |
| 448 | .context("curl_error is not string")? |
| 449 | .to_str()?; |
| 450 | let span_object = span.span_object_mut(); |
| 451 | span_object.is_error = true; |
| 452 | span_object.add_log(vec![("CURL_ERROR", curl_error)]); |
| 453 | } else { |
| 454 | span.span_object_mut().is_error = http_code >= 400; |
| 455 | } |
| 456 | |
| 457 | log_exception(span); |
| 458 | |
| 459 | Ok(()) |
| 460 | } |
| 461 | } |
nothing calls this directly
no test coverage detected