Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions src/main/java/com/wealoha/thrift/ThriftClientPool.java
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package com.wealoha.thrift;

import java.lang.reflect.Proxy;
import java.lang.reflect.InvocationTargetException
import java.util.List;
import java.util.concurrent.atomic.AtomicBoolean;
import java.util.function.Function;
Expand Down Expand Up @@ -285,6 +286,12 @@ public <X> X iface() throws ThriftException {
Object result = method.invoke(client.iFace(), args);
success = true;
return result;
} catch (InvocationTargetException e) {
// Invocation Exceptions are thrown when an error occurs inside the invoke call.
// For the purposes of this proxy class, the InvocationException should be unwrapped
// and the underlying target exception should be thrown instead. This way, the Proxy
// instance will recognized the Checked exception and throw that back to the calling method.
throw e.getTargetException();
} catch (Throwable e) {
logger.warn("invoke fail", e);
throw e;
Expand Down