ThrowReferenceError returns a context's exception value with given error message.
(format string, args ...interface{})
| 1208 | |
| 1209 | // ThrowReferenceError returns a context's exception value with given error message. |
| 1210 | func (ctx *Context) ThrowReferenceError(format string, args ...interface{}) *Value { |
| 1211 | if !ctx.hasValidRef() { |
| 1212 | return nil |
| 1213 | } |
| 1214 | cause := fmt.Sprintf(format, args...) |
| 1215 | causePtr := C.CString(cause) |
| 1216 | defer C.free(unsafe.Pointer(causePtr)) |
| 1217 | return &Value{ctx: ctx, ref: C.ThrowReferenceError(ctx.ref, causePtr)} |
| 1218 | } |
| 1219 | |
| 1220 | // ThrowRangeError returns a context's exception value with given error message. |
| 1221 | func (ctx *Context) ThrowRangeError(format string, args ...interface{}) *Value { |