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

Method ThrowSyntaxError

context.go:1188–1196  ·  view source on GitHub ↗

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

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

Source from the content-addressed store, hash-verified

1186
1187// ThrowSyntaxError returns a context's exception value with given error message.
1188func (ctx *Context) ThrowSyntaxError(format string, args ...interface{}) *Value {
1189 if !ctx.hasValidRef() {
1190 return nil
1191 }
1192 cause := fmt.Sprintf(format, args...)
1193 causePtr := C.CString(cause)
1194 defer C.free(unsafe.Pointer(causePtr))
1195 return &Value{ctx: ctx, ref: C.ThrowSyntaxError(ctx.ref, causePtr)}
1196}
1197
1198// ThrowTypeError returns a context's exception value with given error message.
1199func (ctx *Context) ThrowTypeError(format string, args ...interface{}) *Value {

Calls 1

hasValidRefMethod · 0.95