goldsmith/error.go
2019-04-07 13:43:25 -07:00

22 lines
461 B
Go

package goldsmith
import "fmt"
// Error wraps the core error type to provide a plugin or filter name in
// addition to the file path that was being processed at the time.
type Error struct {
Name string
Path string
Err error
}
// Error returns a string representation of the error.
func (err Error) Error() string {
var path string
if len(err.Path) > 0 {
path = "@" + err.Path
}
return fmt.Sprintf("[%s%s]: %s", err.Name, path, err.Err.Error())
}