Skip to content

How to detect if a ScriptObject is a v8 Error? #564

Answered by ClearScriptLib
viceice asked this question in Q&A
Discussion options

You must be logged in to vote

Hi @viceice,

Why not let the script engine help? Consider:

dynamic isInstanceOf = engine.Evaluate("(x, y) => x instanceof y");

And then:

if (isInstanceOf(obj, engine.Script.Error)) {
    Console.WriteLine("The object is a JavaScript Error!");
}

Good luck!

Replies: 2 comments 1 reply

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
1 reply
@viceice
Comment options

Answer selected by viceice
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants