mirror of
https://github.com/wabbajack-tools/wabbajack.git
synced 2024-08-30 18:42:17 +00:00
Throw critical errors on nexus API quota issues
This commit is contained in:
parent
01872fb62b
commit
e1725bb808
@ -200,6 +200,11 @@ namespace Wabbajack.Lib.Downloaders
|
||||
var client = await NexusApiClient.Get();
|
||||
url = await client.GetNexusDownloadLink(this);
|
||||
}
|
||||
catch (NexusAPIQuotaExceeded ex)
|
||||
{
|
||||
Utils.Log(ex.ExtendedDescription);
|
||||
throw;
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
return false;
|
||||
@ -248,6 +253,8 @@ namespace Wabbajack.Lib.Downloaders
|
||||
public override async Task<(Archive? Archive, TempFile NewFile)> FindUpgrade(Archive a, Func<Archive, Task<AbsolutePath>> downloadResolver)
|
||||
{
|
||||
var client = await NexusApiClient.Get();
|
||||
if (client.RemainingAPICalls <= 0)
|
||||
throw new NexusAPIQuotaExceeded();
|
||||
|
||||
var mod = await client.GetModInfo(Game, ModID);
|
||||
if (!mod.available)
|
||||
|
@ -311,7 +311,7 @@ namespace Wabbajack.Lib.NexusApi
|
||||
{
|
||||
if (HourlyRemaining <= 0 && DailyRemaining <= 0)
|
||||
{
|
||||
throw new Exception($"You have run out of Nexus API requests, please try again after midnight GMT when the API limits reset");
|
||||
throw new NexusAPIQuotaExceeded();
|
||||
}
|
||||
|
||||
var url =
|
||||
|
12
Wabbajack.Lib/StatusMessages/NexusAPIQuotaExceeded.cs
Normal file
12
Wabbajack.Lib/StatusMessages/NexusAPIQuotaExceeded.cs
Normal file
@ -0,0 +1,12 @@
|
||||
using Wabbajack.Common.StatusFeed;
|
||||
|
||||
namespace Wabbajack.Lib
|
||||
{
|
||||
public class NexusAPIQuotaExceeded : AErrorMessage
|
||||
{
|
||||
public override string ShortDescription => $"You have exceeded your Nexus API limit for the day";
|
||||
|
||||
public override string ExtendedDescription =>
|
||||
"You have exceeded your Nexus API limit for the day, please try again after midnight GMT";
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user