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.
精彩评论