Catch and Show an error from a WCF service call in javascript.
- by cw
Hello,
I'm calling a WCF service through javascript and right now it's not showing any errors that might occur on the service side to the user. I have the code below and am looking for a better way to inform the user an error has occured, including the call stack and error message if possible.
The service itself throws a FaultException if an error has occured. However, I want to catch that error in the javascript call and show it to the user.
Here is the js code to call the service
function Save() {
var saveInfo = $("._saveInfo").val()
app.namspace.interfacetoservice.Save(
saveInfo,
function(results) {
if (results == true) {
window.close();
}
else {
alert("error saving");
}
}
);
}
Thanks for the help!