public void HandleException(Exception e, CancellationTokenSource source) { Type exceptionType = e.GetType(); if (exceptionType == typeof(TaskCanceledException)) { TaskCanceledException tce = (TaskCanceledException)e; if (tce.CancellationToken == source.Token) { System.Diagnostics.Debug.WriteLine("VegetableClient::This is a real cancellation triggered by the caller."); } else { System.Diagnostics.Debug.WriteLine("VegetableClient::This is a web request time out."); } } response = new VegResponseObj(); response.message = "Something bad is happening in Oz."; response.vegetables = null; }
public void Serialize(string content) { response = JsonConvert.DeserializeObject <VegResponseObj> (content); }