Skip to content

Commit

Permalink
Return error message if function registration fails (heroiclabs#1075)
Browse files Browse the repository at this point in the history
  • Loading branch information
sesposito authored Aug 28, 2023
1 parent c3b317d commit 7294047
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions server/runtime_javascript_init.go
Original file line number Diff line number Diff line change
Expand Up @@ -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())
Expand Down

0 comments on commit 7294047

Please sign in to comment.