@ b048340a0d68f9609a801d8b97e45aed81821ab5 | history
package eval
import "fmt"
// Error codes. Step 1.13 adds source locations; the codes are stable.
const (
ErrUnbound = "E-UNBOUND"
ErrSyntax = "E-SYNTAX"
ErrSpecialForm = "E-SPECIAL-FORM"
ErrNotAFunction = "E-NOT-A-FUNCTION"
ErrArity = "E-ARITY"
ErrType = "E-TYPE"
ErrArith = "E-ARITH"
)
type Error struct {
Code string
Msg string
}
func (e *Error) Error() string { return e.Code + ": " + e.Msg }
func errorf(code, format string, args ...any) *Error {
return &Error{Code: code, Msg: fmt.Sprintf(format, args...)}
}