Sorry about flood, but this is first JavaScript engine wich I see supported from company, not community project wich will die after some time, I hope so
CS Code:
using RemObjects.Script.EcmaScript;
using System;
using System.Reflection;
namespace ToRemObjects
{
public class MyException : ApplicationException
{
public MyException()
: base(“My exception message text …”)
{ }
public int Code
{
get
{
return -100;
}
}
}
public class TestClass
{
public void DoSomething()
{
throw new MyException();
}
}
class Program
{
static void Main(string[] args)
{
string script = @“
gVar.DoSomething();
”;
using (var esc = new RemObjects.Script.EcmaScriptComponent())
{
esc.Globals.SetVariable(“gVar”, new TestClass());
try
{
esc.RunFunction(“eval”, script);
}
catch (Exception ex)
{
// here can’t be determinate real reason for interrupt
// can’t access MyException.Code or MyException.Message
if (null == ex.InnerException)
Console.WriteLine(“InnerException is null”);
Console.WriteLine(ex.ToString());
}
Console.ReadLine();
}
}
}
}