Exemple #1
0
func (cs ContextScope) TryCatch(callback func()) error {
	msg := C.V8_Context_TryCatch(cs.context.self, unsafe.Pointer(&callback))
	if msg == nil {
		return nil
	}
	return (*Message)(msg)
}
Exemple #2
0
func (cs ContextScope) TryCatch(simple bool, callback func()) string {
	isSimple := 0
	if simple {
		isSimple = 1
	}
	creport := C.V8_Context_TryCatch(cs.context.self, unsafe.Pointer(&callback), C.int(isSimple))
	if creport == nil {
		return ""
	}
	report := C.GoString(creport)
	C.free(unsafe.Pointer(creport))
	return report
}