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

New Post: Gathering error/exception information when using .Execute

$
0
0
What is the preferred/best way to get error information from the script when using .Execute?

Catching 'ScriptEngineException' works... sort of, but it gives very unhelpful data. No line number (from the script itself), no error text that might have been raised or thrown by the script, etc. What it does seem to give is whatever error the interpreter might have thrown.

Here is an example...
1) Exception Type: Microsoft.ClearScript.ScriptEngineException EngineName: VBScriptEngine ErrorDetails: __Object does not support the requested invocation operation__ IsFatal: False Message: Object does not support the requested invocation operation Data: System.Collections.ListDictionaryInternal TargetSite: Void ThrowScriptError(Microsoft.ClearScript.IScriptEngineException) HelpLink: NULL Source: ClearScript HResult: -2146190593 Trace: at Microsoft.ClearScript.ScriptEngine.ThrowScriptError(IScriptEngineException scriptError) at Microsoft.ClearScript.Windows.WindowsScriptEngine.ThrowScriptError(Exception exception) at Microsoft.ClearScript.Windows.WindowsScriptEngine.<>c__DisplayClass14.<ScriptInvoke>b__13() at Microsoft.ClearScript.ScriptEngine.ScriptInvoke(Action action) at Microsoft.ClearScript.Windows.WindowsScriptEngine.ScriptInvoke(Action action) at Microsoft.ClearScript.Windows.WindowsScriptEngine.Execute(String documentName, String code, Boolean evaluate, Boolean discard) at Microsoft.ClearScript.ScriptEngine.Execute(String documentName, Boolean discard, String code) at Microsoft.ClearScript.ScriptEngine.Execute(String documentName, String code) at Microsoft.ClearScript.ScriptEngine.Execute(String code) at EmbeddedScript.Execute() in []EmbeddedScript.cs:line 101 2) Exception Type: System.NotSupportedException Message: Object does not support the requested invocation operation Data: System.Collections.ListDictionaryInternal TargetSite: System.Object InvokeHostMember(System.String, System.Reflection.BindingFlags, System.Object[], System.Object[], System.Globalization.CultureInfo) HelpLink: NULL Source: ClearScript HResult: -2146233067 Trace: at Microsoft.ClearScript.HostItem.InvokeHostMember(String name, BindingFlags invokeFlags, Object[] args, Object[] bindArgs, CultureInfo culture) at Microsoft.ClearScript.HostItem.InvokeMember(String name, BindingFlags invokeFlags, Object[] args, Object[] bindArgs, CultureInfo culture) at Microsoft.ClearScript.HostItem.<>c__DisplayClass3e.<System.Reflection.IReflect.InvokeMember>b__3d() at Microsoft.ClearScript.ScriptEngine.HostInvoke[T](Func`1 func) at Microsoft.ClearScript.Windows.WindowsScriptEngine.HostInvoke[T](Func`1 func)
The call stack is useless, because the error was thrown by the script. Column and line number of the script would be excellent.

Any ideas?

Viewing all articles
Browse latest Browse all 2297

Latest Images

Trending Articles





Latest Images