Beispiel #1
0
 internal static JObject TryParse(string response)
 {
     try {
         return(JObject.Parse(response));
     } catch (Exception e) {
         Console.WriteLine("Could not parse response: \n" + response + "\n" + e);
         AlbotConnection.Terminate();
     }
     return(null); // Unreachable
 }
Beispiel #2
0
 internal static T TryDeserialize <T>(string response)
 {
     try {
         return(JsonConvert.DeserializeObject <T>(response));
     } catch (Exception e) {
         Console.WriteLine("Could not deserialize response: \n" + response + "\n" + e);
         AlbotConnection.Terminate();
     }
     return(default(T)); // Unreachable
 }