avoid outputting errors if diagnostics field provided
All checks were successful
AWS-Zig Build / build-zig-amd64-host (push) Successful in 8m13s

This commit is contained in:
Emil Lerch 2026-02-03 15:30:59 -08:00
parent fd568f26b9
commit c1df6ef3a6
Signed by: lobo
GPG key ID: A7B62D657EF764F8

View file

@ -417,11 +417,21 @@ pub fn Request(comptime request_action: anytype) type {
defer response.deinit();
if (response.response_code != options.success_http_code and response.response_code != 404) {
try reportTraffic(options.client.allocator, "Call Failed", aws_request, response, log.err);
// If the consumer prrovided diagnostics, they are likely handling
// this error themselves. We'll not spam them with log.err
// output. Note that we may need to add additional information
// in diagnostics, as reportTraffic provides more information
// than what exists in the diagnostics data
if (options.diagnostics) |d| {
d.http_code = response.response_code;
d.response_body = try d.allocator.dupe(u8, response.body);
}
} else try reportTraffic(
options.client.allocator,
"Call Failed",
aws_request,
response,
log.err,
);
return error.HttpFailure;
}