mirror of
https://github.com/ppy/osu.git
synced 2025-01-21 08:52:54 +08:00
Merge pull request #19522 from frenzibyte/improve-download-limit-message
Display readable error message when reaching download limit
This commit is contained in:
commit
1eb8168a8d
@ -4,6 +4,7 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
|
using System.Net;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using Humanizer;
|
using Humanizer;
|
||||||
using osu.Framework.Logging;
|
using osu.Framework.Logging;
|
||||||
@ -107,7 +108,15 @@ namespace osu.Game.Database
|
|||||||
notification.State = ProgressNotificationState.Cancelled;
|
notification.State = ProgressNotificationState.Cancelled;
|
||||||
|
|
||||||
if (!(error is OperationCanceledException))
|
if (!(error is OperationCanceledException))
|
||||||
Logger.Error(error, $"{importer.HumanisedModelName.Titleize()} download failed!");
|
{
|
||||||
|
if (error is WebException webException && webException.Message == @"TooManyRequests")
|
||||||
|
{
|
||||||
|
notification.Close();
|
||||||
|
PostNotification?.Invoke(new TooManyDownloadsNotification());
|
||||||
|
}
|
||||||
|
else
|
||||||
|
Logger.Error(error, $"{importer.HumanisedModelName.Titleize()} download failed!");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
26
osu.Game/Database/TooManyDownloadsNotification.cs
Normal file
26
osu.Game/Database/TooManyDownloadsNotification.cs
Normal file
@ -0,0 +1,26 @@
|
|||||||
|
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
|
||||||
|
// See the LICENCE file in the repository root for full licence text.
|
||||||
|
|
||||||
|
using osu.Framework.Allocation;
|
||||||
|
using osu.Framework.Graphics.Sprites;
|
||||||
|
using osu.Game.Graphics;
|
||||||
|
using osu.Game.Overlays.Notifications;
|
||||||
|
using osu.Game.Resources.Localisation.Web;
|
||||||
|
|
||||||
|
namespace osu.Game.Database
|
||||||
|
{
|
||||||
|
public class TooManyDownloadsNotification : SimpleNotification
|
||||||
|
{
|
||||||
|
public TooManyDownloadsNotification()
|
||||||
|
{
|
||||||
|
Text = BeatmapsetsStrings.DownloadLimitExceeded;
|
||||||
|
Icon = FontAwesome.Solid.ExclamationCircle;
|
||||||
|
}
|
||||||
|
|
||||||
|
[BackgroundDependencyLoader]
|
||||||
|
private void load(OsuColour colours)
|
||||||
|
{
|
||||||
|
IconBackground.Colour = colours.RedDark;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -1,4 +1,4 @@
|
|||||||
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
|
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
|
||||||
// See the LICENCE file in the repository root for full licence text.
|
// See the LICENCE file in the repository root for full licence text.
|
||||||
|
|
||||||
using osu.Framework.Localisation;
|
using osu.Framework.Localisation;
|
||||||
|
Loading…
Reference in New Issue
Block a user