vm: improve failed SYSCALL logging
For better user experience.
This commit is contained in:
parent
a43a87675d
commit
0ceae612c6
2 changed files with 7 additions and 3 deletions
|
@ -924,7 +924,7 @@ func TestRunWithHistoricState(t *testing.T) {
|
||||||
e.checkNextLine(t, "READY: loaded 36 instructions")
|
e.checkNextLine(t, "READY: loaded 36 instructions")
|
||||||
e.checkStack(t, []byte{1})
|
e.checkStack(t, []byte{1})
|
||||||
e.checkNextLine(t, "READY: loaded 36 instructions")
|
e.checkNextLine(t, "READY: loaded 36 instructions")
|
||||||
e.checkNextLineExact(t, "Error: at instruction 31 (SYSCALL): failed to invoke syscall 1381727586: called contract cd583ac7a1a4faef70d6e9f513bc988dde22f672 not found: key not found\n")
|
e.checkNextLineExact(t, "Error: at instruction 31 (SYSCALL): System.Contract.Call failed: called contract cd583ac7a1a4faef70d6e9f513bc988dde22f672 not found: key not found\n")
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestEvents(t *testing.T) {
|
func TestEvents(t *testing.T) {
|
||||||
|
@ -1178,7 +1178,7 @@ func TestLoaddeployed(t *testing.T) {
|
||||||
e.checkNextLine(t, "READY: loaded \\d+ instructions")
|
e.checkNextLine(t, "READY: loaded \\d+ instructions")
|
||||||
e.checkStack(t, []byte{2})
|
e.checkStack(t, []byte{2})
|
||||||
e.checkNextLine(t, "READY: loaded \\d+ instructions")
|
e.checkNextLine(t, "READY: loaded \\d+ instructions")
|
||||||
e.checkError(t, errors.New("at instruction 63 (SYSCALL): failed to invoke syscall 837311890: insufficient amount of gas"))
|
e.checkError(t, errors.New("at instruction 63 (SYSCALL): System.Storage.Get failed: insufficient amount of gas"))
|
||||||
e.checkNextLine(t, "READY: loaded \\d+ instructions")
|
e.checkNextLine(t, "READY: loaded \\d+ instructions")
|
||||||
e.checkStack(t, []byte{2})
|
e.checkStack(t, []byte{2})
|
||||||
e.checkNextLine(t, "READY: loaded \\d+ instructions")
|
e.checkNextLine(t, "READY: loaded \\d+ instructions")
|
||||||
|
|
|
@ -1462,7 +1462,11 @@ func (v *VM) execute(ctx *Context, op opcode.Opcode, parameter []byte) (err erro
|
||||||
}
|
}
|
||||||
err := v.SyscallHandler(v, interopID)
|
err := v.SyscallHandler(v, interopID)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
panic(fmt.Sprintf("failed to invoke syscall %d: %s", interopID, err))
|
iName, iErr := interopnames.FromID(interopID)
|
||||||
|
if iErr == nil {
|
||||||
|
panic(fmt.Sprintf("%s failed: %s", iName, err))
|
||||||
|
}
|
||||||
|
panic(fmt.Sprintf("%d failed: %s", interopID, err))
|
||||||
}
|
}
|
||||||
|
|
||||||
case opcode.RET:
|
case opcode.RET:
|
||||||
|
|
Loading…
Reference in a new issue