-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathclass-not-found.go
More file actions
27 lines (21 loc) · 846 Bytes
/
class-not-found.go
File metadata and controls
27 lines (21 loc) · 846 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
// Copyright (c) 2023, Peter Ohler, All rights reserved.
package slip
import "fmt"
// ClassNotFoundSymbol is the symbol with a value of "unbound-slot".
const ClassNotFoundSymbol = Symbol("class-not-found")
// ClassNotFoundNew creates a new ClassNotFound (class-not-found) describing a
// class-not-found error.
func ClassNotFoundNew(s *Scope, depth int, name Object, format string, args ...any) Object {
c := FindClass("class-not-found")
obj := c.MakeInstance()
obj.Init(s, List{
Symbol(":name"), name,
Symbol(":message"), String(fmt.Sprintf(format, args...)),
}, depth)
return obj
}
// ClassNotFoundPanic raises a ClassNotFound (unbound-slot) describing a
// class-not-found error.
func ClassNotFoundPanic(s *Scope, depth int, name Object, format string, args ...any) {
panic(ClassNotFoundNew(s, depth, name, format, args...))
}