示例#1
0
func (d *Context) ErrorRaw(errCode int, filename string, line int, errMsg string) {
	__filename__ := C.CString(filename)
	__errMsg__ := C.CString(errMsg)
	defer C.free(unsafe.Pointer(__filename__))
	defer C.free(unsafe.Pointer(__errMsg__))

	C._duk_error_raw(d.duk_context, C.duk_errcode_t(errCode), __filename__, C.duk_int_t(line), __errMsg__)
}
示例#2
0
// PushErrorObject pushes a new Error object to the stack. This will call
// fmt.Sprint, forwarding arguments after the error code, to produce the
// Error's message.
//
// See: http://duktape.org/api.html#duk_push_error_object
func (d *Context) PushErrorObject(errCode int, a ...interface{}) {
	str := fmt.Sprint(a...)
	__str__ := C.CString(str)
	defer C.free(unsafe.Pointer(__str__))
	C._duk_push_error_object(d.duk_context, C.duk_errcode_t(errCode), __str__)
}
示例#3
0
// See: http://duktape.org/api.html#duk_fatal
func (d *Context) Fatal(errCode int, errMsg string) {
	__errMsg__ := C.CString(errMsg)
	defer C.free(unsafe.Pointer(__errMsg__))
	C.duk_fatal(d.duk_context, C.duk_errcode_t(errCode), __errMsg__)
}
示例#4
0
// Errorf pushes a new Error object to the stack and throws it. This will call
// fmt.Sprintf, forwarding the format string and additional arguments, to
// produce the Error's message.
//
// See: http://duktape.org/api.html#duk_error
func (d *Context) Errorf(errCode int, format string, a ...interface{}) {
	str := fmt.Sprintf(format, a...)
	__str__ := C.CString(str)
	defer C.free(unsafe.Pointer(__str__))
	C._duk_error(d.duk_context, C.duk_errcode_t(errCode), __str__)
}