dop251/goja

How to Throw an Error From the Golang Function

gastraight opened this issue · 0 comments

Hi!
While injecting a golang function into a js runtime how to throw an error js way within this function
e.g.

	runtime := goja.New()
	runtime.Set("aFunc", func() {
               // how to throw an error here
        })
        runtime.RunString(`
              try {
                  aFunc()
              } catch (error) {
                  // so that to be able to catch it over here 
             }
        `)

Thx.