Welcome Guest Search | Active Topics | Sign In | Register

Capturing javascript exception Options
PhilipT
Posted: Thursday, May 15, 2014 2:54:29 AM
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
eo_support
Posted: Thursday, May 15, 2014 3:06:08 PM
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!
PhilipT
Posted: Friday, May 16, 2014 9:57:15 PM
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.

eo_support
Posted: Saturday, May 17, 2014 12:59:38 PM
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!
PhilipT
Posted: Thursday, May 29, 2014 2:03:29 AM
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
eo_support
Posted: Thursday, May 29, 2014 12:49:06 PM
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!


You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.