From 70bd8dafa5997111ef5789af097dc695906a0ff2 Mon Sep 17 00:00:00 2001 From: Emil Lerch Date: Tue, 29 Aug 2023 11:56:01 -0700 Subject: [PATCH] add more information on unexpected response --- src/aws.zig | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/aws.zig b/src/aws.zig index f61e257..41c3034 100644 --- a/src/aws.zig +++ b/src/aws.zig @@ -479,7 +479,13 @@ pub fn Request(comptime request_action: anytype) type { const xml_options = xml_shaper.ParseOptions{ .allocator = options.client.allocator }; var body: []const u8 = result.body; var free_body = false; - if (result.body.len < 20) return error.UnexpectedResponse; + if (result.body.len < 20) { + std.log.err( + "Unexpected response from server. Looking for XML that ends in 'Response' or 'Result'. Found:\n{s}␃\n===", + .{result.body}, + ); + return error.UnexpectedResponse; + } if (std.mem.lastIndexOf(u8, result.body[result.body.len - 20 ..], "Response>") == null and std.mem.lastIndexOf(u8, result.body[result.body.len - 20 ..], "Result>") == null) {