Another fix to error detection...

This commit is contained in:
Rikki Tooley 2013-09-13 19:19:16 +01:00
parent f2b0875503
commit 0a4f58d160

View File

@ -87,8 +87,20 @@ public static string FormatQueryParameters(IEnumerable<KeyValuePair<string, stri
return builder.ToString(); return builder.ToString();
} }
/// <summary>
/// TODO see issue #5
/// </summary>
/// <param name="json">String of JSON</param>
/// <param name="error">Enum indicating the error, .None if there is no error</param>
/// <returns>True when the JSON could be parsed and it didn't describe a known Last.Fm error.</returns>
public static bool IsResponseValid(string json, out LastFmApiError error) public static bool IsResponseValid(string json, out LastFmApiError error)
{ {
if (string.IsNullOrWhiteSpace(json))
{
error = LastFmApiError.Unknown;
return false;
}
JObject jo; JObject jo;
try try
{ {