mirror of
https://github.com/go-task/task.git
synced 2025-05-13 22:16:31 +02:00
36 lines
634 B
Go
36 lines
634 B
Go
package experiments
|
|
|
|
import (
|
|
"fmt"
|
|
"strconv"
|
|
"strings"
|
|
|
|
"github.com/go-task/task/v3/internal/slicesext"
|
|
)
|
|
|
|
type InvalidValueError struct {
|
|
Name string
|
|
AllowedValues []int
|
|
Value int
|
|
}
|
|
|
|
func (err InvalidValueError) Error() string {
|
|
return fmt.Sprintf(
|
|
"task: Experiment %q has an invalid value %q (allowed values: %s)",
|
|
err.Name,
|
|
err.Value,
|
|
strings.Join(slicesext.Convert(err.AllowedValues, strconv.Itoa), ", "),
|
|
)
|
|
}
|
|
|
|
type InactiveError struct {
|
|
Name string
|
|
}
|
|
|
|
func (err InactiveError) Error() string {
|
|
return fmt.Sprintf(
|
|
"task: Experiment %q is inactive and cannot be enabled",
|
|
err.Name,
|
|
)
|
|
}
|