From f23cd3c7c5aa6976100a41b2adc9323db0338858 Mon Sep 17 00:00:00 2001 From: Marcin Torba Date: Thu, 29 Aug 2024 09:52:48 +0200 Subject: [PATCH] Fix exceptions --- .../AzureDevOps.cs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/DependencyUpdated.Repositories.AzureDevOps/AzureDevOps.cs b/src/DependencyUpdated.Repositories.AzureDevOps/AzureDevOps.cs index a78d66e..5a7820a 100644 --- a/src/DependencyUpdated.Repositories.AzureDevOps/AzureDevOps.cs +++ b/src/DependencyUpdated.Repositories.AzureDevOps/AzureDevOps.cs @@ -22,7 +22,7 @@ public void SwitchToDefaultBranch(string repositoryPath) logger.Information("Switching {Repository} to branch {Branch}", repositoryPath, branchName); using var repo = new Repository(repositoryPath); var branch = repo.Branches[branchName] ?? - throw new Exception($"Branch {branchName} doesn't exists"); + throw new InvalidOperationException($"Branch {branchName} doesn't exists"); Commands.Checkout(repo, branch); } @@ -102,7 +102,7 @@ public async Task SubmitPullRequest(IReadOnlyCollection updates, s if (result.StatusCode == HttpStatusCode.NonAuthoritativeInformation) { - throw new Exception("Invalid PAT token provided"); + throw new InvalidOperationException("Invalid PAT token provided"); } var response = await result.Content.ReadAsStringAsync(); @@ -111,7 +111,7 @@ public async Task SubmitPullRequest(IReadOnlyCollection updates, s PropertyNameCaseInsensitive = true, }; var responseObject = JsonSerializer.Deserialize(response, options) ?? - throw new Exception("Missing response from API"); + throw new InvalidOperationException("Missing response from API"); logger.Information("New PR created {Id}", responseObject.PullRequestId); if (configValue.AutoComplete)