Skip to content

Commit 458f391

Browse files
committed
We could be notified of the root exception, not always a wrapping one, see AsyncHttpClient#1070
1 parent 858448f commit 458f391

File tree

2 files changed

+3
-2
lines changed

2 files changed

+3
-2
lines changed

client/src/main/java/org/asynchttpclient/netty/handler/AsyncHttpClientHandler.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -158,7 +158,7 @@ public void channelInactive(ChannelHandlerContext ctx) throws Exception {
158158

159159
@Override
160160
public void exceptionCaught(ChannelHandlerContext ctx, Throwable e) throws Exception {
161-
Throwable cause = getCause(e.getCause());
161+
Throwable cause = getCause(e);
162162

163163
if (cause instanceof PrematureChannelClosureException || cause instanceof ClosedChannelException)
164164
return;

client/src/main/java/org/asynchttpclient/util/MiscUtils.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,7 @@ public static <T extends Exception> T trimStackTrace(T e) {
6565
}
6666

6767
public static Throwable getCause(Throwable t) {
68-
return t.getCause() != null ? t.getCause() : t;
68+
Throwable cause = t.getCause();
69+
return cause != null ? getCause(cause) : t;
6970
}
7071
}

0 commit comments

Comments
 (0)