Open ethangunderson opened 1 year ago
I think it might be worth improving the error message too. In Elixir, we've often done this by removing the arity from the is_function
check. In this case, that is, use is_function(Fun)
instead of is_function(Fun, 4)
. With this, when you try to call the function with a wrong arity, the error message is a lot easier to debug 😉
@whatyouhide I like that suggestion. Do you want me to make that change in this PR?
This has come up a few times for us. It's not always obvious that the function supplied to attach must be
/4
. When supplying something else you get an exception message that also doesn't reveal the problem.I'm hoping that adding a slightly more explicit explanation of the function argument in function doc will help some people avoid this confusion in the future.