Skip to content

Commit

Permalink
Fix more microerror removal caused regression
Browse files Browse the repository at this point in the history
  • Loading branch information
uvegla committed Feb 11, 2025
1 parent da59918 commit 68d7d2c
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions pkg/generator/generator.go
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ func (g *Generator) GenerateRawConfigUnsorted(ctx context.Context, app string) (
// Check if installation folder exists at all. If not, return a descriptive
// error.
if _, err := g.fs.ReadDir(installationsPath + g.installation); err != nil {
if errors.Is(err, &NotFoundError{}) {
if errors.Is(err, os.ErrNotExist) {
return "", "", &NotFoundError{
message: fmt.Sprintf("cannot generate config for installation %s, because \"installations/%s\" does not exist", g.installation, g.installation),
}
Expand All @@ -138,7 +138,7 @@ func (g *Generator) GenerateRawConfigUnsorted(ctx context.Context, app string) (
}
// Check if app folder exists at all. If not, return a descriptive error.
if _, err := g.fs.ReadDir(appsDefaultPath + app); err != nil {
if errors.Is(err, &NotFoundError{}) {
if errors.Is(err, os.ErrNotExist) {
return "", "", &NotFoundError{
message: fmt.Sprintf("cannot generate config for app %s, because \"default/apps/%s\" does not exist", app, app),
}
Expand Down Expand Up @@ -389,6 +389,10 @@ func (g *Generator) getWithPatchIfExists(ctx context.Context, filepath, patchFil
{
base, err = g.fs.ReadFile(filepath)
if err != nil {
if errors.Is(err, os.ErrNotExist) {
return "", &NotFoundError{message: fmt.Sprintf("File not found: %q: %s", filepath, err)}
}

return "", err
}
}
Expand All @@ -402,7 +406,7 @@ func (g *Generator) getWithPatchIfExists(ctx context.Context, filepath, patchFil
{
patch, err = g.fs.ReadFile(patchFilepath)
if err != nil {
if errors.Is(err, &NotFoundError{}) {
if errors.Is(err, os.ErrNotExist) {
return string(base), nil
}
return "", err
Expand Down

0 comments on commit 68d7d2c

Please sign in to comment.