Skip to content

Commit

Permalink
Preserve original exception in jetty http client wrappers (#7455)
Browse files Browse the repository at this point in the history
Same issue as in
#7452
  • Loading branch information
laurit committed Dec 21, 2022
1 parent d38bc4d commit e683fd9
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@

import io.opentelemetry.context.Context;
import io.opentelemetry.context.Scope;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Proxy;
import java.util.ArrayList;
import java.util.List;
Expand Down Expand Up @@ -71,6 +72,8 @@ private static Response.ResponseListener wrapTheListener(
(proxy, method, args) -> {
try (Scope ignored = context.makeCurrent()) {
return method.invoke(listener, args);
} catch (InvocationTargetException exception) {
throw exception.getCause();
}
});
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
import io.opentelemetry.context.Scope;
import io.opentelemetry.instrumentation.api.instrumenter.Instrumenter;
import io.opentelemetry.semconv.trace.attributes.SemanticAttributes;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Proxy;
import java.util.ArrayList;
import java.util.List;
Expand Down Expand Up @@ -118,6 +119,8 @@ private void wrapRequestListeners(List<Request.RequestListener> requestListeners
(proxy, method, args) -> {
try (Scope ignored = context.makeCurrent()) {
return method.invoke(listener, args);
} catch (InvocationTargetException exception) {
throw exception.getCause();
}
});

Expand Down

0 comments on commit e683fd9

Please sign in to comment.