mirror of
https://github.com/Sarsoo/IF.Lastfm.git
synced 2024-10-17 07:13:09 +01:00
Remove CatchRequestExceptions option, closes #23
This commit is contained in:
parent
063a7466a0
commit
f267ab1735
@ -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;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -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;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -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)
|
||||||
|
Loading…
Reference in New Issue
Block a user