Code returns the code of the `Trap` if it exists, nil otherwise.
()
| 102 | |
| 103 | // Code returns the code of the `Trap` if it exists, nil otherwise. |
| 104 | func (t *Trap) Code() *TrapCode { |
| 105 | var code C.uint8_t |
| 106 | var ret *TrapCode |
| 107 | ok := C.wasmtime_trap_code(t.ptr(), &code) |
| 108 | if ok == C._Bool(true) { |
| 109 | ret = (*TrapCode)(&code) |
| 110 | } |
| 111 | runtime.KeepAlive(t) |
| 112 | return ret |
| 113 | } |
| 114 | |
| 115 | func (t *Trap) Error() string { |
| 116 | return t.Message() |