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

Method ThrowError

context.go:1179–1185  ·  view source on GitHub ↗

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

(err error)

Source from the content-addressed store, hash-verified

1177
1178// ThrowError returns a context's exception value with given error message.
1179func (ctx *Context) ThrowError(err error) *Value {
1180 if !ctx.hasValidRef() {
1181 return nil
1182 }
1183 v := ctx.NewError(err)
1184 return &Value{ctx: ctx, ref: C.JS_Throw(ctx.ref, v.ref)}
1185}
1186
1187// ThrowSyntaxError returns a context's exception value with given error message.
1188func (ctx *Context) ThrowSyntaxError(format string, args ...interface{}) *Value {

Callers 14

TestContextErrorHandlingFunction · 0.95
EvalFileMethod · 0.95
LoadModuleMethod · 0.95
LoadModuleFileMethod · 0.95
BindClassMethod · 0.95
createClassFunction · 0.80
createMethodWrapperFunction · 0.80
createFieldGetterFunction · 0.80
createFieldSetterFunction · 0.80
convertMethodResultsFunction · 0.80

Calls 2

hasValidRefMethod · 0.95
NewErrorMethod · 0.95