From 1b415d7a7fa0709f775db808ce7057c0d2d3eae4 Mon Sep 17 00:00:00 2001 From: Liza Carvelli Date: Wed, 8 Mar 2023 01:27:10 +0100 Subject: [PATCH] Improve repo exception handling --- Pal.Client/DependencyInjection/RepoVerification.cs | 6 +++++- Pal.Client/Plugin.cs | 9 +++------ 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/Pal.Client/DependencyInjection/RepoVerification.cs b/Pal.Client/DependencyInjection/RepoVerification.cs index 07c41bc..349bf46 100644 --- a/Pal.Client/DependencyInjection/RepoVerification.cs +++ b/Pal.Client/DependencyInjection/RepoVerification.cs @@ -19,8 +19,12 @@ namespace Pal.Client.DependencyInjection { chat.Error(string.Format(Localization.Error_WrongRepository, "https://github.com/carvelli/Dalamud-Plugins")); - throw new InvalidOperationException(); + throw new RepoVerificationFailedException(); } } + + internal sealed class RepoVerificationFailedException : Exception + { + } } } diff --git a/Pal.Client/Plugin.cs b/Pal.Client/Plugin.cs index aefe7b1..e917743 100644 --- a/Pal.Client/Plugin.cs +++ b/Pal.Client/Plugin.cs @@ -102,12 +102,9 @@ namespace Pal.Client _rootScopeCompletionSource.SetResult(_rootScope); _loadState = ELoadState.Loaded; } - catch (ObjectDisposedException e) - { - _rootScopeCompletionSource.SetException(e); - _loadState = ELoadState.Error; - } - catch (OperationCanceledException e) + catch (Exception e) when (e is ObjectDisposedException + or OperationCanceledException + or RepoVerification.RepoVerificationFailedException) { _rootScopeCompletionSource.SetException(e); _loadState = ELoadState.Error;