ThrowTypeError returns a context's exception value with given error message.
(format string, args ...interface{})
| 1197 | |
| 1198 | // ThrowTypeError returns a context's exception value with given error message. |
| 1199 | func (ctx *Context) ThrowTypeError(format string, args ...interface{}) *Value { |
| 1200 | if !ctx.hasValidRef() { |
| 1201 | return nil |
| 1202 | } |
| 1203 | cause := fmt.Sprintf(format, args...) |
| 1204 | causePtr := C.CString(cause) |
| 1205 | defer C.free(unsafe.Pointer(causePtr)) |
| 1206 | return &Value{ctx: ctx, ref: C.ThrowTypeError(ctx.ref, causePtr)} |
| 1207 | } |
| 1208 | |
| 1209 | // ThrowReferenceError returns a context's exception value with given error message. |
| 1210 | func (ctx *Context) ThrowReferenceError(format string, args ...interface{}) *Value { |