Improve repo exception handling

This commit is contained in:
Liza 2023-03-08 01:27:10 +01:00
parent c5acb2ca54
commit 1b415d7a7f
2 changed files with 8 additions and 7 deletions

View File

@ -19,8 +19,12 @@ namespace Pal.Client.DependencyInjection
{ {
chat.Error(string.Format(Localization.Error_WrongRepository, chat.Error(string.Format(Localization.Error_WrongRepository,
"https://github.com/carvelli/Dalamud-Plugins")); "https://github.com/carvelli/Dalamud-Plugins"));
throw new InvalidOperationException(); throw new RepoVerificationFailedException();
} }
} }
internal sealed class RepoVerificationFailedException : Exception
{
}
} }
} }

View File

@ -102,12 +102,9 @@ namespace Pal.Client
_rootScopeCompletionSource.SetResult(_rootScope); _rootScopeCompletionSource.SetResult(_rootScope);
_loadState = ELoadState.Loaded; _loadState = ELoadState.Loaded;
} }
catch (ObjectDisposedException e) catch (Exception e) when (e is ObjectDisposedException
{ or OperationCanceledException
_rootScopeCompletionSource.SetException(e); or RepoVerification.RepoVerificationFailedException)
_loadState = ELoadState.Error;
}
catch (OperationCanceledException e)
{ {
_rootScopeCompletionSource.SetException(e); _rootScopeCompletionSource.SetException(e);
_loadState = ELoadState.Error; _loadState = ELoadState.Error;