File tree Expand file tree Collapse file tree 1 file changed +9
-6
lines changed Expand file tree Collapse file tree 1 file changed +9
-6
lines changed Original file line number Diff line number Diff line change @@ -403,17 +403,20 @@ defmodule HTTPClient.Steps do
403403 end
404404 end
405405
406- defp retry_safe ( request , response ) do
406+ defp retry_safe ( request , response_or_exception ) do
407407 if request . method in [ :get , :head ] do
408- case response do
408+ case response_or_exception do
409409 % Response { status: status } when status in [ 408 , 429 ] or status in 500 .. 599 ->
410- retry ( request , response )
410+ retry ( request , response_or_exception )
411411
412412 % Response { } ->
413- { request , response }
413+ { request , response_or_exception }
414+
415+ exception when is_exception ( exception ) ->
416+ retry ( request , response_or_exception )
414417 end
415418 else
416- { request , response }
419+ { request , response_or_exception }
417420 end
418421 end
419422
@@ -545,7 +548,7 @@ defmodule HTTPClient.Steps do
545548 end
546549
547550 case response_or_exception do
548- % { __exception__: true } = exception ->
551+ exception when is_exception ( exception ) ->
549552 Logger . error ( [ "retry: got exception. " , message ] )
550553 Logger . error ( [ "** (#{ inspect ( exception . __struct__ ) } ) " , Exception . message ( exception ) ] )
551554
You can’t perform that action at this time.
0 commit comments