These are chat archives for olebedev/go-duktape

4th
Jun 2016
Juan Pablo Stumpf
@juanolon
Jun 04 2016 14:25
hi @olebedev i got modules to work :) my fault
one question, how do you handle errors? duk_error(), or in js throw new error() ? in errors thrown in javascript are correctly catched. but errors withe the duktape api crashes go
Oleg Lebedev
@olebedev
Jun 04 2016 14:31
Hi, look at protected call duktape api
Juan Pablo Stumpf
@juanolon
Jun 04 2016 14:32
you mean, pcall()?
Juan Pablo Stumpf
@juanolon
Jun 04 2016 14:41
errors on js works. only errors on go make crash the whole programm "fatal error: runtime: stack split at bad time"
whether i call:
ctx.Error(100, "test") or
ctx.Errorf(100, "Module %s not found.", id) or
ctx.PushErrorObject(100, "Module %s not found", id) ctx.Throw()
Juan Pablo Stumpf
@juanolon
Jun 04 2016 18:23
hey @olebedev can you explain me what does this line do:
https://github.com/olebedev/go-duktape/blob/v2/duktape.go#L83
exactly this (*[0]byte)(C.goFunctionCall) i've never seen that before, and would be interesting to understand that :) thanks
Oleg Lebedev
@olebedev
Jun 04 2016 19:15
It's cgo conversation to pass c.func pointer