diff --git a/internal/helm/chart/builder_local.go b/internal/helm/chart/builder_local.go index a527d384..ed9b7baf 100644 --- a/internal/helm/chart/builder_local.go +++ b/internal/helm/chart/builder_local.go @@ -65,11 +65,12 @@ func NewLocalBuilder(dm *DependencyManager) Builder { func (b *localChartBuilder) Build(ctx context.Context, ref Reference, p string, opts BuildOptions) (*Build, error) { localRef, ok := ref.(LocalReference) if !ok { - return nil, fmt.Errorf("expected local chart reference") + err := fmt.Errorf("expected local chart reference") + return nil, &BuildError{Reason: ErrChartReference, Err: err} } if err := ref.Validate(); err != nil { - return nil, &BuildError{Reason: ErrChartPull, Err: err} + return nil, &BuildError{Reason: ErrChartReference, Err: err} } // Load the chart metadata from the LocalReference to ensure it points diff --git a/internal/helm/chart/builder_remote.go b/internal/helm/chart/builder_remote.go index edf1797a..ab58d0e8 100644 --- a/internal/helm/chart/builder_remote.go +++ b/internal/helm/chart/builder_remote.go @@ -64,11 +64,12 @@ func NewRemoteBuilder(repository *repository.ChartRepository) Builder { func (b *remoteChartBuilder) Build(_ context.Context, ref Reference, p string, opts BuildOptions) (*Build, error) { remoteRef, ok := ref.(RemoteReference) if !ok { - return nil, fmt.Errorf("expected remote chart reference") + err := fmt.Errorf("expected remote chart reference") + return nil, &BuildError{Reason: ErrChartReference, Err: err} } if err := ref.Validate(); err != nil { - return nil, &BuildError{Reason: ErrChartPull, Err: err} + return nil, &BuildError{Reason: ErrChartReference, Err: err} } if err := b.remote.LoadFromCache(); err != nil { diff --git a/internal/helm/chart/errors.go b/internal/helm/chart/errors.go index ab074a2b..dddd2e29 100644 --- a/internal/helm/chart/errors.go +++ b/internal/helm/chart/errors.go @@ -61,6 +61,7 @@ func (e *BuildError) Unwrap() error { } var ( + ErrChartReference = BuildErrorReason("chart reference error") ErrChartPull = BuildErrorReason("chart pull error") ErrChartMetadataPatch = BuildErrorReason("chart metadata patch error") ErrValuesFilesMerge = BuildErrorReason("values files merge error")