Files
console/error.go
andrey1s 1151e7c3ad
All checks were successful
continuous-integration/drone/push Build is passing
continuous-integration/drone/pr Build is passing
check empty execute
2022-09-24 12:16:23 +03:00

32 lines
643 B
Go

package console
import (
"errors"
"fmt"
"strings"
)
var (
ErrNotFound = errors.New("command not found")
ErrCommandNil = errors.New("console: Register command is nil")
ErrExecuteNil = errors.New("console: execute is nil")
ErrCommandDuplicate = errors.New("console: duplicate command")
)
type AlternativesError struct {
Alt []string
Err error
}
func (e AlternativesError) Error() string {
return fmt.Sprintf("%s, alternatives: [%s]", e.Err, strings.Join(e.Alt, ","))
}
func (e AlternativesError) Is(err error) bool {
return errors.Is(e.Err, err)
}
func (e AlternativesError) Unwrap() error {
return e.Err
}