How to Throw an Error From the Golang Function #600
gastraight
started this conversation in
General
Replies: 1 comment
-
runtime = goja.New()
runtime.Set("Read", func (path) {
data, err := os.ReadFile(path)
if err != nil {
panic(runtime.ToValue(err))
}
return string(data)
})
runtime.RunString(`
try {
Read("test")
} catch (err) {
console.log(err)
}
`) hi @gastraight you can use this example to throw error from golang to the vm here |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hi!
While injecting a golang function into a js runtime how to throw an error js way within this function
e.g.
Thx.
Beta Was this translation helpful? Give feedback.
All reactions