Skip to content

Commit

Permalink
Pass the retry error to user side
Browse files Browse the repository at this point in the history
  • Loading branch information
ruhan1 committed Oct 11, 2024
1 parent 6df155b commit c7ecfc1
Showing 1 changed file with 4 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -384,6 +384,7 @@ public Response intercept( @NotNull Chain chain ) throws IOException
{
Request req = chain.request();
Response resp = null;
IOException latestException = null;
int tryCounter = 0;
do {
if ( resp != null )
Expand Down Expand Up @@ -417,10 +418,7 @@ public Response intercept( @NotNull Chain chain ) throws IOException
}
catch( IOException e )
{
if ( tryCounter >= count )
{
throw e;
}
latestException = e;

Span.current().setAttribute( "target.try." + tryCounter + ".error_message", e.getMessage() );
Span.current()
Expand All @@ -447,7 +445,8 @@ public Response intercept( @NotNull Chain chain ) throws IOException

Span.current().setAttribute( "target.retries", tryCounter );

throw new IOException( "Proxy retry interceptor reached an unexpected fall-through condition!" );
return new Response.Builder().code( 500 ).message( String.format(
"Proxy retry interceptor reached an unexpected fall-through condition! %s", latestException ) ).build();
}
}

Expand Down

0 comments on commit c7ecfc1

Please sign in to comment.