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

Method ThrowInternalError

context.go:1232–1240  ·  view source on GitHub ↗

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

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

Source from the content-addressed store, hash-verified

1230
1231// ThrowInternalError returns a context's exception value with given error message.
1232func (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.
1243func (ctx *Context) HasException() bool {

Callers 8

TestContextErrorHandlingFunction · 0.95
AwaitMethod · 0.95
throwProxyErrorFunction · 0.80
throwModuleErrorFunction · 0.80
goClassConstructorProxyFunction · 0.80

Calls 1

hasValidRefMethod · 0.95