@ b9cb2994f443455b061cf4e3054f9b89234f78a0 | 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"
ErrNotImplemented = "E-NOT-IMPLEMENTED"
)
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...)}
}