Unverified Commit 7294047b authored by Simon Esposito's avatar Simon Esposito Committed by GitHub
Browse files

Return error message if function registration fails (#1075)

parent c3b317d8
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -298,8 +298,8 @@ func (im *RuntimeJavascriptInitModule) registerRpc(r *goja.Runtime) func(goja.Fu
		}

		v := fnObj.Get("name")
		if v == nil {
			panic(r.NewTypeError("function key could not be extracted"))
		if v == nil || v.String() == "" {
			panic(r.NewTypeError("function key could not be extracted: cannot register an anonymous function"))
		}

		fnKey := strings.Clone(v.String())