avoid outputting errors if diagnostics field provided
All checks were successful
AWS-Zig Build / build-zig-amd64-host (push) Successful in 8m13s
All checks were successful
AWS-Zig Build / build-zig-amd64-host (push) Successful in 8m13s
This commit is contained in:
parent
fd568f26b9
commit
c1df6ef3a6
1 changed files with 12 additions and 2 deletions
14
src/aws.zig
14
src/aws.zig
|
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue