Rhino.Context.ThrowAsScriptRuntimeEx C# (CSharp) Method

ThrowAsScriptRuntimeEx() public static method

Rethrow the exception wrapping it as the script runtime exception.
Rethrow the exception wrapping it as the script runtime exception. Unless the exception is instance of EcmaError or EvaluatorException it will be wrapped as WrappedException , a subclass of EvaluatorException . The resulting exception object always contains source name and line number of script that triggered exception.

This method always throws an exception, its return value is provided only for convenience to allow a usage like:

 throw Context.throwAsScriptRuntimeEx(ex); 
to indicate that code after the method is unreachable.
EvaluatorException EcmaError
public static ThrowAsScriptRuntimeEx ( Exception e ) : Exception
e Exception
return Exception
		public static Exception ThrowAsScriptRuntimeEx(Exception e)
		{
			while ((e is TargetInvocationException))
			{
				e = ((TargetInvocationException)e).InnerException;
			}
			// special handling of Error so scripts would not catch them
			if (e is Exception)
			{
				Rhino.Context cx = GetContext();
				if (cx == null || !cx.HasFeature(Rhino.Context.FEATURE_ENHANCED_JAVA_ACCESS))
				{
					throw (Exception)e;
				}
			}
			if (e is RhinoException)
			{
				throw (RhinoException)e;
			}
			throw new WrappedException(e);
		}
Context