2017-03-03 01:48:00 +02:00
|
|
|
package task
|
|
|
|
|
|
|
|
import (
|
2017-06-04 21:02:04 +02:00
|
|
|
"errors"
|
2017-03-03 01:48:00 +02:00
|
|
|
"fmt"
|
|
|
|
)
|
|
|
|
|
2017-06-04 21:02:04 +02:00
|
|
|
var (
|
|
|
|
// ErrTaskfileAlreadyExists is returned on creating a Taskfile if one already exists
|
|
|
|
ErrTaskfileAlreadyExists = errors.New("task: A Taskfile already exists")
|
|
|
|
)
|
|
|
|
|
2017-03-03 01:48:00 +02:00
|
|
|
type taskNotFoundError struct {
|
|
|
|
taskName string
|
|
|
|
}
|
|
|
|
|
|
|
|
func (err *taskNotFoundError) Error() string {
|
2017-03-03 01:56:37 +02:00
|
|
|
return fmt.Sprintf(`task: Task "%s" not found`, err.taskName)
|
2017-03-03 01:48:00 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
type taskRunError struct {
|
|
|
|
taskName string
|
|
|
|
err error
|
|
|
|
}
|
|
|
|
|
|
|
|
func (err *taskRunError) Error() string {
|
2017-03-03 01:56:37 +02:00
|
|
|
return fmt.Sprintf(`task: Failed to run task "%s": %v`, err.taskName, err.err)
|
2017-03-03 01:48:00 +02:00
|
|
|
}
|
|
|
|
|
2017-07-08 18:33:55 +02:00
|
|
|
// MaximumTaskCallExceededError is returned when a task is called too
|
|
|
|
// many times. In this case you probably have a cyclic dependendy or
|
|
|
|
// infinite loop
|
|
|
|
type MaximumTaskCallExceededError struct {
|
|
|
|
task string
|
|
|
|
}
|
|
|
|
|
|
|
|
func (e *MaximumTaskCallExceededError) Error() string {
|
|
|
|
return fmt.Sprintf(
|
|
|
|
`task: maximum task call exceeded (%d) for task "%s": probably an cyclic dep or infinite loop`,
|
|
|
|
MaximumTaskCall,
|
|
|
|
e.task,
|
|
|
|
)
|
|
|
|
}
|