Error handling
This commit is contained in:
parent
8786d944cb
commit
f329c6802a
|
@ -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<ByteString> params) throws Throwable {
|
||||
public String invoke(String serviceName, String methodName, List<ByteString> 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 {
|
||||
|
|
Loading…
Reference in New Issue
Block a user