-
Notifications
You must be signed in to change notification settings - Fork 7
/
trapid.go
49 lines (40 loc) · 1.37 KB
/
trapid.go
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
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
// Copyright (c) 2020 Timo Savola. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
// Package trap enumerates trap identifiers.
package trap
import (
wagtrap "gate.computer/wag/trap"
)
type ID wagtrap.ID
const (
Exit = ID(wagtrap.Exit)
NoFunction = ID(wagtrap.NoFunction)
Suspended = ID(wagtrap.Suspended)
Unreachable = ID(wagtrap.Unreachable)
CallStackExhausted = ID(wagtrap.CallStackExhausted)
MemoryAccessOutOfBounds = ID(wagtrap.MemoryAccessOutOfBounds)
IndirectCallIndexOutOfBounds = ID(wagtrap.IndirectCallIndexOutOfBounds)
IndirectCallSignatureMismatch = ID(wagtrap.IndirectCallSignatureMismatch)
IntegerDivideByZero = ID(wagtrap.IntegerDivideByZero)
IntegerOverflow = ID(wagtrap.IntegerOverflow)
Breakpoint = ID(wagtrap.Breakpoint)
ABIDeficiency = ID(27)
ABIViolation = ID(28)
InternalError = ID(29)
Killed = ID(30)
)
func (id ID) String() string {
switch id {
case ABIDeficiency:
return "ABI deficiency"
case ABIViolation:
return "ABI violation"
case InternalError:
return "internal error"
case Killed:
return "killed"
default:
return wagtrap.ID(id).String()
}
}