Skip to content

Commit c5abf9a

Browse files
committed
fix: better error handling when resolving component version
1 parent d1f6ec8 commit c5abf9a

File tree

2 files changed

+10
-6
lines changed

2 files changed

+10
-6
lines changed
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
kind: Fixed
2+
body: Better error message when resolving a component version
3+
time: 2025-04-10T09:20:29.467644537+02:00

internal/cloud/resolver.go

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -38,16 +38,17 @@ func resolveComponentVersion(ctx context.Context, cfg *config.MachConfig, c *con
3838
organization := cfg.MachComposer.Cloud.Organization
3939
project := cfg.MachComposer.Cloud.Project
4040

41-
version, _, err := client.
42-
ComponentsApi.ComponentLatestVersion(ctx, organization, project, c.Name).
41+
version, res, err := client.
42+
ComponentsApi.
43+
ComponentLatestVersion(ctx, organization, project, c.Name).
4344
Branch(c.Branch).
4445
Execute()
4546
if err != nil {
46-
return err
47-
}
47+
if res != nil && res.StatusCode == 404 {
48+
return fmt.Errorf("component %s (branch %s) could not be found", c.Name, c.Branch)
49+
}
4850

49-
if version == nil {
50-
return fmt.Errorf("failed to resolve latest version for component %s (branch %s)", c.Name, c.Branch)
51+
return fmt.Errorf("failed to resolve latest version for component %s (branch %s): %s", c.Name, c.Branch, err.Error())
5152
}
5253

5354
c.Version = version.Version

0 commit comments

Comments
 (0)