Files
console/errs/errors.go
andrey 1382bea590
All checks were successful
Go Action / goaction (pull_request) Successful in 2m26s
update commands
2026-01-06 16:19:45 +03:00

33 lines
639 B
Go

package errs
import (
"errors"
"fmt"
"strings"
)
var (
ErrWrongType = errors.New("wrong type")
ErrNotFound = errors.New("not found")
ErrCommandNil = errors.New("command is nil")
ErrExecuteNil = errors.New("execute is nil")
ErrCommandDplicate = errors.New("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
}