Browse Source

Fix error messages about non-existent files

renovate/configure
Yota Toyama 8 years ago
parent
commit
1486d4db0a
  1. 1
      examples/error.feature
  2. 10
      file_result.go

1
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"

10
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())

Loading…
Cancel
Save