mirror of
https://github.com/davidallendj/magellan.git
synced 2025-12-20 11:37:01 -07:00
Added error related util functions
This commit is contained in:
parent
9c5fd3c142
commit
b024675e92
1 changed files with 12 additions and 0 deletions
|
|
@ -98,3 +98,15 @@ func SplitPathForViper(path string) (string, string, string) {
|
|||
ext := filepath.Ext(filename)
|
||||
return filepath.Dir(path), strings.TrimSuffix(filename, ext), strings.TrimPrefix(ext, ".")
|
||||
}
|
||||
|
||||
func FormatErrorList(errList []error) error {
|
||||
var err error
|
||||
for i, e := range errList {
|
||||
err = fmt.Errorf("\t[%d] %v\n", i, e)
|
||||
}
|
||||
return err
|
||||
}
|
||||
|
||||
func HasErrors(errList []error) bool {
|
||||
return len(errList) > 0
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue