mirror of
https://github.com/Readarr/Readarr.git
synced 2026-04-21 22:04:31 -04:00
Better handling of SAB not returning json to addfile
Fixed: Handling of unexpected responses from SABnzbd when adding releases
This commit is contained in:
@@ -41,6 +41,18 @@ namespace NzbDrone.Common.Serializer
|
||||
return JsonConvert.DeserializeObject(json, type, SerializerSetting);
|
||||
}
|
||||
|
||||
public static T TryDeserialize<T>(string json) where T : new()
|
||||
{
|
||||
try
|
||||
{
|
||||
return Deserialize<T>(json);
|
||||
}
|
||||
catch (JsonReaderException ex)
|
||||
{
|
||||
return default(T);
|
||||
}
|
||||
}
|
||||
|
||||
public static string ToJson(this object obj)
|
||||
{
|
||||
return JsonConvert.SerializeObject(obj, SerializerSetting);
|
||||
|
||||
Reference in New Issue
Block a user