Remove CatchRequestExceptions option, closes #23

This commit is contained in:
Rikki Tooley 2014-12-23 00:07:37 +00:00
parent 063a7466a0
commit f267ab1735
3 changed files with 3 additions and 28 deletions

View File

@ -14,7 +14,7 @@ protected GetAsyncCommandBase(ILastAuth auth)
Auth = auth; Auth = auth;
} }
public async override Task<T> ExecuteAsync() public override async Task<T> ExecuteAsync()
{ {
SetParameters(); SetParameters();
@ -30,14 +30,7 @@ public async override Task<T> ExecuteAsync()
} }
catch (HttpRequestException) catch (HttpRequestException)
{ {
if (LastFm.CatchRequestExceptions) throw;
{
return LastResponse.CreateErrorResponse<T>(LastFmApiError.RequestFailed);
}
else
{
throw;
}
} }
} }

View File

@ -39,14 +39,7 @@ public override async Task<T> ExecuteAsync()
} }
catch (HttpRequestException) catch (HttpRequestException)
{ {
if (LastFm.CatchRequestExceptions) return LastResponse.CreateErrorResponse<T>(LastFmApiError.RequestFailed);
{
return LastResponse.CreateErrorResponse<T>(LastFmApiError.RequestFailed);
}
else
{
throw;
}
} }
} }
} }

View File

@ -27,17 +27,6 @@ public class LastFm
#endregion #endregion
/// <summary>
/// Determines whether commands should throw HttpRequestExceptions or wrap them
/// in the response.
///
/// Using this can make client code neater, but it violates the principles of
/// separation of concerns and single responsibility a bit. This property won't
/// get removed but please only use it if you understand what it does!
/// </summary>
[Obsolete]
public static bool CatchRequestExceptions { get; set; }
#region Api helper methods #region Api helper methods
public static string FormatApiUrl(string method, string apikey, Dictionary<string, string> parameters = null, bool secure = false) public static string FormatApiUrl(string method, string apikey, Dictionary<string, string> parameters = null, bool secure = false)