MCPcopy Create free account
hub / github.com/buke/quickjs-go / ThrowReferenceError

Method ThrowReferenceError

context.go:1210–1218  ·  view source on GitHub ↗

ThrowReferenceError returns a context's exception value with given error message.

(format string, args ...interface{})

Source from the content-addressed store, hash-verified

1208
1209// ThrowReferenceError returns a context's exception value with given error message.
1210func (ctx *Context) ThrowReferenceError(format string, args ...interface{}) *Value {
1211 if !ctx.hasValidRef() {
1212 return nil
1213 }
1214 cause := fmt.Sprintf(format, args...)
1215 causePtr := C.CString(cause)
1216 defer C.free(unsafe.Pointer(causePtr))
1217 return &Value{ctx: ctx, ref: C.ThrowReferenceError(ctx.ref, causePtr)}
1218}
1219
1220// ThrowRangeError returns a context's exception value with given error message.
1221func (ctx *Context) ThrowRangeError(format string, args ...interface{}) *Value {

Calls 1

hasValidRefMethod · 0.95