1
0
mirror of https://github.com/go-task/task.git synced 2025-06-17 00:17:51 +02:00

Move error types to its own file

This commit is contained in:
Andrey Nering
2017-03-02 20:48:00 -03:00
parent b8116015c7
commit a9b8e31228
2 changed files with 33 additions and 30 deletions

33
errors.go Normal file
View File

@ -0,0 +1,33 @@
package task
import (
"fmt"
)
// ErrNoTaskFile is returned when the program can not find a proper TaskFile
var ErrNoTaskFile = fmt.Errorf(`No task file found (is it named "%s"?)`, TaskFilePath)
type taskNotFoundError struct {
taskName string
}
func (err *taskNotFoundError) Error() string {
return fmt.Sprintf(`Task "%s" not found`, err.taskName)
}
type taskRunError struct {
taskName string
err error
}
func (err *taskRunError) Error() string {
return fmt.Sprintf(`Failed to run task "%s": %v`, err.taskName, err.err)
}
type cyclicDepError struct {
taskName string
}
func (err *cyclicDepError) Error() string {
return fmt.Sprintf(`Cyclic dependency of task "%s" detected`, err.taskName)
}