开发者

Message of Javascript exception in C#

i'm doing some unit tests in Silverlight. Therefore i'm invoking some javascript functions. i'd like to know how to get the message of the exception thrown in javascript开发者_如何学Python. Is this possible?

Thanks! Peter


Here you go:

try {

foo();

} catch (e) {

alert("An exception occurred in the script. Error name: " + e.name 
+ ". Error message: " + e.message); }

<Edit> Sorry, I just realized you need this in C# code. In order to do that, you'll have to take this data and pass it into your C# code somehow, whether by AJAX or form submission or something.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜