Report while filename failed to parse #1030

This commit is contained in:
Mike Farah 2021-12-06 17:25:32 +11:00
parent c17cf82791
commit ffd1f022aa
3 changed files with 5 additions and 3 deletions

View File

@ -244,7 +244,7 @@ Next, we convert the map back to an array, using reduce again, concatenating all
Finally, we set the result of the merged array back into the first doc.
To use this, you will need to update '.myArray' to be the expression to your array (e.g. .my.array), and '.a' to be the key field of your array (e.g. '.name')
To use this, you will need to update '.myArray' in the expression to your array (e.g. .my.array), and '.a' to be the key field of your array (e.g. '.name')
Thanks Kev from [stackoverflow](https://stackoverflow.com/a/70109529/1168223)

View File

@ -3,6 +3,7 @@ package yqlib
import (
"container/list"
"errors"
"fmt"
"io"
"os"
@ -100,7 +101,7 @@ func (s *streamEvaluator) Evaluate(filename string, reader io.Reader, node *Expr
s.fileIndex = s.fileIndex + 1
return currentIndex, nil
} else if errorReading != nil {
return currentIndex, errorReading
return currentIndex, fmt.Errorf("bad file '%v': %w", filename, errorReading)
}
candidateNode := &CandidateNode{

View File

@ -4,6 +4,7 @@ import (
"bufio"
"container/list"
"errors"
"fmt"
"io"
"os"
"regexp"
@ -122,7 +123,7 @@ func readDocuments(reader io.Reader, filename string, fileIndex int) (*list.List
}
return inputList, nil
} else if errorReading != nil {
return nil, errorReading
return nil, fmt.Errorf("bad file '%v': %w", filename, errorReading)
}
candidateNode := &CandidateNode{
Document: currentIndex,