Skip to content

Commit

Permalink
clear error when spectral is not installed (#1164)
Browse files Browse the repository at this point in the history
  • Loading branch information
theganyo authored May 2, 2023
1 parent 8da9343 commit 2d8c94b
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion cmd/registry/plugins/registry-lint-spectral/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ import (
"os"
"os/exec"
"path/filepath"
"strings"

lint "github.com/apigee/registry/cmd/registry/plugins/linter"
"github.com/apigee/registry/pkg/application/style"
Expand Down Expand Up @@ -198,11 +199,17 @@ func runSpectralLinter(specPath, configPath string) ([]*spectralLintResult, erro
case *exec.ExitError:
code := v.ExitCode()
if code == 1 {
// This just means there were linter errors
// This just means the linter found errors
} else {
log.Printf("linter error %T (%s)", err, specPath)
log.Printf("%s", string(output))
}
case *exec.Error:
if strings.Contains(v.Err.Error(), "executable file not found") {
return nil, v.Err
}
log.Printf("linter error %T (%s)", err, specPath)
log.Printf("%s", string(output))
default:
log.Printf("linter error %T (%s)", err, specPath)
log.Printf("%s", string(output))
Expand Down

0 comments on commit 2d8c94b

Please sign in to comment.