Error Handling with Client Binders

Now, it is somethings required that you need to know whats going wrong in the service or you want to throw some errors intentionally from WCF services and you want to handle them in the UI property.

There is a event in the base ClientBinder class that you can use to handle error. The event is named "OnClientError" and raised for any exception raised from the service class. You can hook a method like the follwoing and track errors.

OnClientError="MyErrorMethod"

And inside you can do:

function MyErrorMethod(sender, args) { 
        var errorDetail = args.get_error().Detail;
        alert(errorDetail);      
 
}

When this method is raised, success methods like OnClientSaved, will not be fired.

Related topics:

Feedback

How useful is this article?

Tell us more

Submit
Your message was successfully sent.

We appreciate your feedback.

Your message could not be sent.

OK