forked from toolshed/abra
refactor: urfave v3
This commit is contained in:
4
vendor/github.com/go-git/gcfg/scanner/errors.go
generated
vendored
4
vendor/github.com/go-git/gcfg/scanner/errors.go
generated
vendored
@ -18,6 +18,7 @@ import (
|
||||
// The position Pos, if valid, points to the beginning of
|
||||
// the offending token, and the error condition is described
|
||||
// by Msg.
|
||||
//
|
||||
type Error struct {
|
||||
Pos token.Position
|
||||
Msg string
|
||||
@ -35,6 +36,7 @@ func (e Error) Error() string {
|
||||
|
||||
// ErrorList is a list of *Errors.
|
||||
// The zero value for an ErrorList is an empty ErrorList ready to use.
|
||||
//
|
||||
type ErrorList []*Error
|
||||
|
||||
// Add adds an Error with given position and error message to an ErrorList.
|
||||
@ -64,6 +66,7 @@ func (p ErrorList) Less(i, j int) bool {
|
||||
// Sort sorts an ErrorList. *Error entries are sorted by position,
|
||||
// other errors are sorted by error message, and before any *Error
|
||||
// entry.
|
||||
//
|
||||
func (p ErrorList) Sort() {
|
||||
sort.Sort(p)
|
||||
}
|
||||
@ -106,6 +109,7 @@ func (p ErrorList) Err() error {
|
||||
// PrintError is a utility function that prints a list of errors to w,
|
||||
// one error per line, if the err parameter is an ErrorList. Otherwise
|
||||
// it prints the err string.
|
||||
//
|
||||
func PrintError(w io.Writer, err error) {
|
||||
if list, ok := err.(ErrorList); ok {
|
||||
for _, e := range list {
|
||||
|
Reference in New Issue
Block a user