diff --git a/src/main/java/com/vectron/fcl/exceptions/InterOpFailed.java b/src/main/java/com/vectron/fcl/exceptions/InterOpFailed.java index d7da7f0..ddfb499 100644 --- a/src/main/java/com/vectron/fcl/exceptions/InterOpFailed.java +++ b/src/main/java/com/vectron/fcl/exceptions/InterOpFailed.java @@ -1,7 +1,7 @@ package com.vectron.fcl.exceptions; public class InterOpFailed extends FclException { - public InterOpFailed(Exception e) { + public InterOpFailed(Throwable e) { super(e); } diff --git a/src/main/java/com/vectron/fcl/interop/MethodSpec.java b/src/main/java/com/vectron/fcl/interop/MethodSpec.java index 321daee..b83d878 100644 --- a/src/main/java/com/vectron/fcl/interop/MethodSpec.java +++ b/src/main/java/com/vectron/fcl/interop/MethodSpec.java @@ -9,6 +9,7 @@ import com.vectron.fcl.types.Num; import com.vectron.fcl.types.Obj; import com.vectron.fcl.types.Str; +import java.lang.reflect.InvocationTargetException; import java.lang.reflect.Method; import java.util.ArrayList; import java.util.List; @@ -66,6 +67,8 @@ class MethodSpec { Object result = method.invoke(receiver, params.toArray(new Object[0])); if (!method.getReturnType().getSimpleName().equals("void")) processResult(result, stack); + } catch (InvocationTargetException e) { + throw new InterOpFailed(e.getCause() != null ? e.getCause() : e); } catch (ReflectiveOperationException e) { throw new InterOpFailed(e); }