2018-12-08 19:18:51 +00:00
|
|
|
package goldsmith
|
|
|
|
|
|
|
|
import "fmt"
|
|
|
|
|
2019-04-07 20:43:25 +00:00
|
|
|
// 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.
|
2018-12-08 19:18:51 +00:00
|
|
|
type Error struct {
|
|
|
|
Name string
|
|
|
|
Path string
|
|
|
|
Err error
|
|
|
|
}
|
|
|
|
|
2019-04-07 20:43:25 +00:00
|
|
|
// Error returns a string representation of the error.
|
2018-12-10 01:00:46 +00:00
|
|
|
func (err Error) Error() string {
|
2018-12-08 19:18:51 +00:00
|
|
|
var path string
|
2018-12-10 01:00:46 +00:00
|
|
|
if len(err.Path) > 0 {
|
|
|
|
path = "@" + err.Path
|
2018-12-08 19:18:51 +00:00
|
|
|
}
|
|
|
|
|
2018-12-10 01:00:46 +00:00
|
|
|
return fmt.Sprintf("[%s%s]: %s", err.Name, path, err.Err.Error())
|
2018-12-08 19:18:51 +00:00
|
|
|
}
|