Skip to content

Commit c820d83

Browse files
aykevldeadprogram
authored andcommitted
interp: better errors when debugging interp
When debugging is enabled for interp, print better errors in a specific case. Before: !! revert because of error: interp: unsupported instruction (to be emitted at runtime) After: !! revert because of error: /usr/local/go1.24.0/src/regexp/syntax/parse.go:927:27: interp: unsupported instruction (to be emitted at runtime) So this adds error location information, which can be quite useful.
1 parent 109e076 commit c820d83

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

interp/interpreter.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -577,7 +577,7 @@ func (r *runner) run(fn *function, params []value, parentMem *memoryView, indent
577577
// runtime instead of at compile time. But we need to
578578
// revert any changes made by the call first.
579579
if r.debug {
580-
fmt.Fprintln(os.Stderr, indent+"!! revert because of error:", callErr.Err)
580+
fmt.Fprintln(os.Stderr, indent+"!! revert because of error:", callErr.Error())
581581
}
582582
callMem.revert()
583583
err := r.runAtRuntime(fn, inst, locals, &mem, indent)

0 commit comments

Comments
 (0)