ThrowSyntaxError returns a context's exception value with given error message.
(format string, args ...interface{})
| 1186 | |
| 1187 | // ThrowSyntaxError returns a context's exception value with given error message. |
| 1188 | func (ctx *Context) ThrowSyntaxError(format string, args ...interface{}) *Value { |
| 1189 | if !ctx.hasValidRef() { |
| 1190 | return nil |
| 1191 | } |
| 1192 | cause := fmt.Sprintf(format, args...) |
| 1193 | causePtr := C.CString(cause) |
| 1194 | defer C.free(unsafe.Pointer(causePtr)) |
| 1195 | return &Value{ctx: ctx, ref: C.ThrowSyntaxError(ctx.ref, causePtr)} |
| 1196 | } |
| 1197 | |
| 1198 | // ThrowTypeError returns a context's exception value with given error message. |
| 1199 | func (ctx *Context) ThrowTypeError(format string, args ...interface{}) *Value { |