diff --git a/src/main/java/com/loafle/overflow/proxy/ServiceInvoker.java b/src/main/java/com/loafle/overflow/proxy/ServiceInvoker.java index d9b3026..40012b5 100644 --- a/src/main/java/com/loafle/overflow/proxy/ServiceInvoker.java +++ b/src/main/java/com/loafle/overflow/proxy/ServiceInvoker.java @@ -2,6 +2,8 @@ package com.loafle.overflow.proxy; import com.google.gson.internal.Primitives; import com.google.protobuf.ByteString; +import com.loafle.overflow.commons.exception.OverflowException; +import com.loafle.overflow.commons.exception.OverflowRuntimeException; import com.loafle.overflow.proxy.exception.InvalidParameterException; import com.loafle.overflow.proxy.exception.InvalidRequestException; import com.loafle.overflow.proxy.exception.NoSuchMethodException; @@ -156,7 +158,7 @@ public class ServiceInvoker { } - public String invoke(String serviceName, String methodName, List params) throws Throwable { + public String invoke(String serviceName, String methodName, List params) throws OverflowException, OverflowRuntimeException { Cache serviceCache = getServiceCache(serviceName); Cache.MethodCache methodCache = serviceCache.getMethodCache(methodName); @@ -182,7 +184,11 @@ public class ServiceInvoker { } catch (IllegalAccessException e) { throw new InvalidRequestException(); } catch (InvocationTargetException e) { - throw e.getTargetException(); + Throwable t = e.getTargetException(); + if (t instanceof OverflowRuntimeException) { + throw (OverflowRuntimeException)t; + } + throw new InvalidRequestException(); } try {