I want run some JavaScript file in c# platform in a console application, for example:
using System;
using System.Threading.Tasks;
using EdgeJs;
class Program
{
public static async Task Start()
{
var func = Edge.Func(@"
return function (data, callback) {
var hello = function() {
// some javascript syntax error ...
return ' Hello ' + data;
};
callback(null, hello());
}
");
Console.WriteLine(await func("Word!"));
}
static void Main(string[] args)
{
Start().Wait();
}
}
But when my js function has a error it does not give me any error text or hint to detect my errors .
So how can i get error text in Edgejs in c# when run a JS function ?
One approach can be this:
I mean using try catch in my js code but if could be other way without changing js code, it was excellent.