go-calc/calc/errors.go

27 lines
918 B
Go
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

package calc
import (
"fmt"
)
const (
errEmpty = "%s est vide"
errNotExist = "%s nexiste pas"
errNeed2Nbs = "%s contient moins de 2 éléments"
errUnknown = "commande inconnue : '%s'"
errStack = "La pile"
errReg = "Le registre '%s'"
errMemory = "La mémoire"
errMacro = "La macro '%s'"
errStayArgs = "la liste des arguments restants à parser"
errCallback = "La fonction de callback nest pas définie"
errParser = "La fonction de parsage nest pas définie"
)
func ErrIsEmpty(s string) error { return fmt.Errorf(errEmpty, s) }
func ErrNotExist(s string) error { return fmt.Errorf(errNotExist, s) }
func ErrLenLt2(s string) error { return fmt.Errorf(errNeed2Nbs, s) }
func ErrIsUnknow(s string) error { return fmt.Errorf(errUnknown, s) }
func reg(s string) string { return fmt.Sprintf(errReg, s) }
func mac(s string) string { return fmt.Sprintf(errMacro, s) }