diff --git a/examples/error.feature b/examples/error.feature index 1aa5bd5..efadd9d 100644 --- a/examples/error.feature +++ b/examples/error.feature @@ -8,3 +8,4 @@ Feature: Error Given a file named "foo.md" with "" When I run `linkcheck bar.md` Then the exit status should be 1 + And the stderr should contain "no such file" diff --git a/file_result.go b/file_result.go index 813fa91..2c345c1 100644 --- a/file_result.go +++ b/file_result.go @@ -1,6 +1,10 @@ package main -import "strings" +import ( + "strings" + + "github.com/fatih/color" +) type fileResult struct { filename string @@ -11,6 +15,10 @@ type fileResult struct { func (r fileResult) String(verbose bool) string { ss := make([]string, 0, len(r.urlResults)) + if r.err != nil { + ss = append(ss, "\t"+color.RedString(r.err.Error())) + } + for _, r := range r.urlResults { if r.err != nil || verbose { ss = append(ss, "\t"+r.String())