Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
changes:
- section: "Bugs Fixed"
description: "Fixed AVM module-not-found errors returning HTTP 422 instead of 400 by using ArgumentException for invalid module names"
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ public async Task<List<AvmVersion>> GetVersionsAsync(string moduleName, Cancella
{
var modules = await GetModuleCollectionAsync(cancellationToken).ConfigureAwait(false);
var module = modules.Find(m => string.Equals(m.ModuleName, moduleName, StringComparison.OrdinalIgnoreCase))
?? throw new InvalidOperationException($"Module '{moduleName}' not found in available modules.");
?? throw new ArgumentException($"Module '{moduleName}' not found in available modules.", nameof(moduleName));

var apiUrl = module.RepoUrl
.Replace("github.com", "api.github.com/repos", StringComparison.OrdinalIgnoreCase) + "/releases";
Expand Down Expand Up @@ -67,7 +67,7 @@ public async Task<string> GetDocumentationAsync(string moduleName, string module
{
var modules = await GetModuleCollectionAsync(cancellationToken).ConfigureAwait(false);
var module = modules.Find(m => string.Equals(m.ModuleName, moduleName, StringComparison.OrdinalIgnoreCase))
?? throw new InvalidOperationException($"Module '{moduleName}' not found in available modules.");
?? throw new ArgumentException($"Module '{moduleName}' not found in available modules.", nameof(moduleName));

var cleanVersion = moduleVersion.TrimStart('v');

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ public async Task ExecuteAsync_MissingModuleVersion_ReturnsValidationError()
public async Task ExecuteAsync_ServiceThrows_HandlesException()
{
Service.GetDocumentationAsync(Arg.Any<string>(), Arg.Any<string>(), Arg.Any<CancellationToken>())
.ThrowsAsync(new InvalidOperationException("Module not found"));
.ThrowsAsync(new ArgumentException("Module not found", "moduleName"));

var response = await ExecuteCommandAsync("--module-name", "nonexistent", "--module-version", "1.0.0");

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ public async Task ExecuteAsync_MissingModuleName_ReturnsValidationError()
public async Task ExecuteAsync_ServiceThrows_HandlesException()
{
Service.GetVersionsAsync(Arg.Any<string>(), Arg.Any<CancellationToken>())
.ThrowsAsync(new InvalidOperationException("Module not found"));
.ThrowsAsync(new ArgumentException("Module not found", "moduleName"));

var response = await ExecuteCommandAsync("--module-name", "nonexistent-module");

Expand Down