Skip to content

Commit

Permalink
Fix exceptions
Browse files Browse the repository at this point in the history
  • Loading branch information
torbacz committed Aug 29, 2024
1 parent bf5cd18 commit f23cd3c
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/DependencyUpdated.Repositories.AzureDevOps/AzureDevOps.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Expand Down Expand Up @@ -102,7 +102,7 @@ public async Task SubmitPullRequest(IReadOnlyCollection<UpdateResult> 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();
Expand All @@ -111,7 +111,7 @@ public async Task SubmitPullRequest(IReadOnlyCollection<UpdateResult> updates, s
PropertyNameCaseInsensitive = true,
};
var responseObject = JsonSerializer.Deserialize<PullRequestResponse>(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)
Expand Down

0 comments on commit f23cd3c

Please sign in to comment.