From 5d64c1b7bfd7fd5ce51a2df503735a4f794b9517 Mon Sep 17 00:00:00 2001 From: cdwcgt Date: Sun, 9 Apr 2023 15:09:18 +0900 Subject: [PATCH] exception handling --- osu.Game/Database/LegacyModelExporter.cs | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/osu.Game/Database/LegacyModelExporter.cs b/osu.Game/Database/LegacyModelExporter.cs index 1c5d6b4813..7904be7f4f 100644 --- a/osu.Game/Database/LegacyModelExporter.cs +++ b/osu.Game/Database/LegacyModelExporter.cs @@ -124,8 +124,15 @@ namespace osu.Game.Database cancellationToken == CancellationToken.None ? notification.CancellationToken : cancellationToken).ConfigureAwait(false); } } - catch (OperationCanceledException) + catch { + notification.State = ProgressNotificationState.Cancelled; + throw; + } + finally + { + // Determines whether to export repeatedly, so he must be removed from the list at the end whether there is a error. + exporting_models.Remove(model); } // cleanup if export is failed or canceled. @@ -141,7 +148,6 @@ namespace osu.Game.Database notification.State = ProgressNotificationState.Completed; } - exporting_models.Remove(model); return success; } @@ -171,7 +177,7 @@ namespace osu.Game.Database if (t.IsFaulted) { Logger.Error(t.Exception, "An error occurred while exporting", LoggingTarget.Database); - return false; + throw t.Exception!; } return true;