Catch a server side exception in Windows Phone Async Service

This code is working sorry if any error on the copy paste

public class SyncTicketsDown
{
    SR.WsTicketSyncSoapClient client = Tools.ServiceManager.GetConnection();

    public void ResolveTicket(int TicketID)
    {
        client.ResolveTicketAsync(TicketID)
    }

    void client_ResolveCompleted(object sender, SR.ResolveTicketCompletedEventArgs e)
    {
         if (e.Result > 0)
         {
             Tools.IOSettings.DeleteTicket(e.Result);
         }
    }  
} 

If the Ticket ID is not a valid id on server side, the server will thrown an exception, how can I catch this exception? We are talking that I am running about 40 different services on this app and the service reference create by Visual Studio has like 5000 lines (Reference.cs), when the exception is thrown the debugger will explode on the reference to the service on this class not on my class.

I am also having the same problem with bing route service when you try to get to a place that is to far the server throws an exception that said "To far to calculate" this exception is reflected in the Reference.cs class.

There must be a standard way to catch these exceptions .

Upvotes: 2

Views: 462

Answers (1)

I actually find that even that the debugger explode on Reference.cs it will scale the error to the Complete event and i can manage the error there, is a litter confusing because the debugger stop on reference.cs

all the server side error will be reflected on the complete event

It was not the same question but is similar answer

Windows phone 7, silverlight - How to catch EndpointNotFoundException when calling async web service?

Upvotes: 1

Related Questions