Files
console/errors/errors.go
andrey e80e292830
All checks were successful
Go Action / goaction (pull_request) Successful in 45s
move command to folder
2026-01-05 23:23:20 +03:00

33 lines
657 B
Go

package errors //nolint:revive
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
}