tags:

views:

14

answers:

1

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!

A: 
app.namspace.interfacetoservice.Save( 
    saveInfo, 
    function(results) { 
        if (results == true) { 
            window.close(); 
        } 
        else { 
            alert("error saving"); 
        } 
    },
    function(error) { 
        alert(error.get_StackTrace());
    });

Thanks if anyone was looking into this, I was unaware of the second callback that happens for errors.

cw