Browse Source

Add JintInteropException exception to handle exceptions better on the Jint consumer side

auz34 11 years ago
parent
commit
460fa70c63

+ 1 - 0
Jint/Jint.csproj

@@ -173,6 +173,7 @@
     <Compile Include="Runtime\Environments\ObjectEnvironmentRecord.cs" />
     <Compile Include="Runtime\ExpressionIntepreter.cs" />
     <Compile Include="Runtime\Interop\DefaultTypeConverter.cs" />
+    <Compile Include="Runtime\Interop\JintInteropException.cs" />
     <Compile Include="Runtime\Interop\IObjectWrapper.cs" />
     <Compile Include="Runtime\Interop\IObjectConverter.cs" />
     <Compile Include="Runtime\Interop\ITypeConverter.cs" />

+ 12 - 0
Jint/Runtime/Interop/JintInteropException.cs

@@ -0,0 +1,12 @@
+using System;
+
+namespace Jint.Runtime.Interop
+{
+    public class JintInteropException: Exception
+    {
+        public JintInteropException(Exception innerException)
+            : base("", innerException)
+        {
+        }
+    }
+}

+ 4 - 2
Jint/Runtime/Interop/MethodInfoFunctionInstance.cs

@@ -6,6 +6,8 @@ using Jint.Native.Function;
 
 namespace Jint.Runtime.Interop
 {
+    using System;
+
     public sealed class MethodInfoFunctionInstance : FunctionInstance
     {
         private readonly MethodInfo[] _methods;
@@ -54,9 +56,9 @@ namespace Jint.Runtime.Interop
 
                     return result;
                 }
-                catch
+                catch (Exception ex)
                 {
-                    // ignore method
+                    throw new JintInteropException(ex);
                 }
             }