ThrowError returns a context's exception value with given error message.
(err error)
| 1177 | |
| 1178 | // ThrowError returns a context's exception value with given error message. |
| 1179 | func (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. |
| 1188 | func (ctx *Context) ThrowSyntaxError(format string, args ...interface{}) *Value { |