Skip to content

Commit

Permalink
Feat/3140/better error message on mixin missing (#3145)
Browse files Browse the repository at this point in the history
* WIP: Add extra error when mixin missing

Signed-off-by: David Gannon <19214156+dgannon991@users.noreply.github.com>

* Added more information to the error message

Signed-off-by: David Gannon <19214156+dgannon991@users.noreply.github.com>

---------

Signed-off-by: David Gannon <19214156+dgannon991@users.noreply.github.com>
Co-authored-by: schristoff <28318173+schristoff@users.noreply.github.com>
  • Loading branch information
dgannon991 and schristoff authored Jun 3, 2024
1 parent 59974ae commit b7b00c5
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion pkg/linter/linter.go
Original file line number Diff line number Diff line change
Expand Up @@ -210,7 +210,7 @@ func (l *Linter) Lint(ctx context.Context, m *manifest.Manifest) (Results, error
return nil, span.Error(fmt.Errorf("error validating action: %s", action.name))
}
results = append(results, res...)
}
}

deps := make(map[string]interface{}, len(m.Dependencies.Requires))
for _, dep := range m.Dependencies.Requires {
Expand Down Expand Up @@ -247,6 +247,10 @@ func (l *Linter) Lint(ctx context.Context, m *manifest.Manifest) (Results, error
if strings.Contains(response.Error.Error(), "unknown command") {
continue
}
// put a helpful error when the mixin is not installed
if strings.Contains(response.Error.Error(), "not installed") {
return nil, span.Error(fmt.Errorf("mixin %[1]s is not currently installed. To find view more details you can run: porter mixin search %[1]s. To install you can run porter mixin install %[1]s", response.Name))
}
return nil, span.Error(fmt.Errorf("lint command failed for mixin %s: %s", response.Name, response.Stdout))
}

Expand Down

0 comments on commit b7b00c5

Please sign in to comment.