ThrowInternalError returns a context's exception value with given error message.
(format string, args ...interface{})
| 1230 | |
| 1231 | // ThrowInternalError returns a context's exception value with given error message. |
| 1232 | func (ctx *Context) ThrowInternalError(format string, args ...interface{}) *Value { |
| 1233 | if !ctx.hasValidRef() { |
| 1234 | return nil |
| 1235 | } |
| 1236 | cause := fmt.Sprintf(format, args...) |
| 1237 | causePtr := C.CString(cause) |
| 1238 | defer C.free(unsafe.Pointer(causePtr)) |
| 1239 | return &Value{ctx: ctx, ref: C.ThrowInternalError(ctx.ref, causePtr)} |
| 1240 | } |
| 1241 | |
| 1242 | // HasException checks if the context has an exception set. |
| 1243 | func (ctx *Context) HasException() bool { |