Quantcast
Channel: ClearScript
Viewing all articles
Browse latest Browse all 2297

New Post: Getting JS exception

$
0
0
Hi there,

I'm back with more exception-related questions! :)
Now I'm trying to handle (or at least, correctly log) an unhandled exception thrown from JS.

Something like this:
engine.Execute("throw 'hello'");
will throw a ScriptEngineException with its Message set to 'hello'.

But when the JS throws an object, like:
engine.Execute("throw { field: 'hello' }");
it looks like there is no way to retrieve the object from the ScriptEngineException, whose Message only says "[object Object]".

I get pretty much the same results when throwing a CLR object from JS, with the exception's Message getting "[object HostObject]".

So is there any other way to catch in .NET objects thrown from JS?

Thanks!

Viewing all articles
Browse latest Browse all 2297

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>