Skip to content

Commit 7363c92

Browse files
committed
Fix setting of response body for StatusError exception
As reported in JuliaCloud/AWS.jl#593, the recently refactored retry logic was failing to properly write the response body when a `response_stream` was used and a `StatusError` was thrown.
1 parent 487de2c commit 7363c92

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

src/clientlayers/MessageRequest.jl

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
module MessageRequest
22

33
using URIs
4-
using ..IOExtras, ..Messages, ..Parsers
4+
using ..IOExtras, ..Messages, ..Parsers, ..Exceptions
55

66
export messagelayer
77

@@ -17,6 +17,12 @@ function messagelayer(handler)
1717
local resp
1818
try
1919
resp = handler(req; response_stream=response_stream, kw...)
20+
catch e
21+
if e isa StatusError
22+
resp = e.response
23+
else
24+
rethrow(e)
25+
end
2026
finally
2127
if @isdefined(resp) && iserror(resp) && haskey(resp.request.context, :response_body)
2228
if isbytes(resp.body)

0 commit comments

Comments
 (0)