Skip to content

Commit

Permalink
Update error message to use mrb.Raisef
Browse files Browse the repository at this point in the history
  • Loading branch information
elct9620 committed Aug 15, 2024
1 parent e83fdbe commit f6765d5
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions class.go
Original file line number Diff line number Diff line change
Expand Up @@ -115,12 +115,12 @@ func (mrb *State) vmDefineClass(outer Value, super Value, id Symbol) (RClass, er
if ClassP(super) {
superClass = super.(RClass)
} else {
panic("super is not a class")
mrb.Raisef(nil, "superclass must be a Class (%T given)", super)
}
}

if !ClassPointerP(outer) {
panic("outer is not a class or module")
mrb.Raisef(nil, "outer is not a class or module")
}
outerModule := outer.(RClass)

Expand Down
2 changes: 1 addition & 1 deletion vm.go
Original file line number Diff line number Diff line change
Expand Up @@ -346,7 +346,7 @@ func (mrb *State) VmExec(proc RProc, code *insn.Sequence) (ret Value, err error)

recv, ok := ctx.Get(int(a)).(RClass)
if !ok {
panic(fmt.Errorf("not a class: %v", ctx.Get(int(a))))
mrb.Raisef(nil, "not a class: %v", ctx.Get(int(a)))
}

nirep := rep.Representation(b)
Expand Down

0 comments on commit f6765d5

Please sign in to comment.