|
Rank: Advanced Member Groups: Member
Joined: 2/15/2014 Posts: 52
|
Hi,
Is there a way for a .NET host app to capture the javascript exception? I'm not referring to invoking a javascript function from .NET side but general javascript exception due to syntax error, object not defined, etc. I would like to be able to capture it and log it in the eventvwr similar to the default .NET WebBrowser control where it provides the information of which filename and line number the error occurred?
Regards Philip
|
|
Rank: Administration Groups: Administration
Joined: 5/27/2007 Posts: 24,196
|
Hi,
You would need to handle the WebView's ConsoleMessage event. Currently the event pass a ConsoleMessageEventArgs object which contains error message and location (source Url and line number). A JavaScript exception will trigger this event.
However a console.log call also triggers this event. Thus the event lacks a Severity property which would allow you to distinguish an exception and a debug trace. We will have this property in our next build. It will have four values: Debug, Log, Warning and Error. An Severity of Error would correspond to a JavaScript exception.
Thanks!
|
|
Rank: Advanced Member Groups: Member
Joined: 2/15/2014 Posts: 52
|
Hi eo,
Thanks for the info. I was looking for some kind of JSScriptException event inside the WebView class, didn't know this ConsoleMessage event is already the one. The Severity property is good to have but i think we can live without it for now since we can identify if we are doing debug by putting "Debug:" at the start of the console.log parameter.
Thanks again.
|
|
Rank: Administration Groups: Administration
Joined: 5/27/2007 Posts: 24,196
|
Great. Please feel free to let us know if there is anything else.
Thanks!
|
|
Rank: Advanced Member Groups: Member
Joined: 2/15/2014 Posts: 52
|
Hi eo,
May i know if the plan to have this severity property in ConsolMessage event is available?
Thanks
|
|
Rank: Administration Groups: Administration
Joined: 5/27/2007 Posts: 24,196
|
Hi,
Yes. It's already available. Please see your private message for the download location of the new build.
Thanks!
|
|