mirror of
https://github.com/wabbajack-tools/wabbajack.git
synced 2024-08-30 18:42:17 +00:00
Merge pull request #1184 from wabbajack-tools/quota-exceeded-in-nexus-upgrades
Throw critical errors on nexus API quota issues
This commit is contained in:
commit
c84ce49b93
@ -200,6 +200,11 @@ namespace Wabbajack.Lib.Downloaders
|
|||||||
var client = await NexusApiClient.Get();
|
var client = await NexusApiClient.Get();
|
||||||
url = await client.GetNexusDownloadLink(this);
|
url = await client.GetNexusDownloadLink(this);
|
||||||
}
|
}
|
||||||
|
catch (NexusAPIQuotaExceeded ex)
|
||||||
|
{
|
||||||
|
Utils.Log(ex.ExtendedDescription);
|
||||||
|
throw;
|
||||||
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
return false;
|
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)
|
public override async Task<(Archive? Archive, TempFile NewFile)> FindUpgrade(Archive a, Func<Archive, Task<AbsolutePath>> downloadResolver)
|
||||||
{
|
{
|
||||||
var client = await NexusApiClient.Get();
|
var client = await NexusApiClient.Get();
|
||||||
|
if (client.RemainingAPICalls <= 0)
|
||||||
|
throw new NexusAPIQuotaExceeded();
|
||||||
|
|
||||||
var mod = await client.GetModInfo(Game, ModID);
|
var mod = await client.GetModInfo(Game, ModID);
|
||||||
if (!mod.available)
|
if (!mod.available)
|
||||||
|
@ -311,7 +311,7 @@ namespace Wabbajack.Lib.NexusApi
|
|||||||
{
|
{
|
||||||
if (HourlyRemaining <= 0 && DailyRemaining <= 0)
|
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 =
|
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