From 01aa8c8d1afd656840a5c15b1cea28d7f2aff3c1 Mon Sep 17 00:00:00 2001 From: Emil Lerch Date: Sat, 12 Jun 2021 13:38:50 -0700 Subject: [PATCH] add http error handling --- src/aws.zig | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/aws.zig b/src/aws.zig index 1d78cc0..4dd0fee 100644 --- a/src/aws.zig +++ b/src/aws.zig @@ -61,6 +61,11 @@ pub const Aws = struct { }, ); defer response.deinit(); + if (response.response_code != 200) { + log.err("call failed! return status: {d}", .{response.response_code}); + log.err("{s}", .{response.body}); + return error.HttpFailure; + } // TODO: Check status code for badness var stream = json.TokenStream.init(response.body);