Skip to content

Commit 2d8c94b

Browse files
authored
clear error when spectral is not installed (#1164)
1 parent 8da9343 commit 2d8c94b

File tree

1 file changed

+8
-1
lines changed
  • cmd/registry/plugins/registry-lint-spectral

1 file changed

+8
-1
lines changed

cmd/registry/plugins/registry-lint-spectral/main.go

+8-1
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ import (
2020
"os"
2121
"os/exec"
2222
"path/filepath"
23+
"strings"
2324

2425
lint "github.com/apigee/registry/cmd/registry/plugins/linter"
2526
"github.com/apigee/registry/pkg/application/style"
@@ -198,11 +199,17 @@ func runSpectralLinter(specPath, configPath string) ([]*spectralLintResult, erro
198199
case *exec.ExitError:
199200
code := v.ExitCode()
200201
if code == 1 {
201-
// This just means there were linter errors
202+
// This just means the linter found errors
202203
} else {
203204
log.Printf("linter error %T (%s)", err, specPath)
204205
log.Printf("%s", string(output))
205206
}
207+
case *exec.Error:
208+
if strings.Contains(v.Err.Error(), "executable file not found") {
209+
return nil, v.Err
210+
}
211+
log.Printf("linter error %T (%s)", err, specPath)
212+
log.Printf("%s", string(output))
206213
default:
207214
log.Printf("linter error %T (%s)", err, specPath)
208215
log.Printf("%s", string(output))

0 commit comments

Comments
 (0)