Skip to content

Instantly share code, notes, and snippets.

@dongyuwei
Last active July 10, 2017 02:46
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dongyuwei/48042b33d191880ddbdde80e581e6577 to your computer and use it in GitHub Desktop.
Save dongyuwei/48042b33d191880ddbdde80e581e6577 to your computer and use it in GitHub Desktop.
Erlang's method_missing : '$handle_undefined_function'
-module(method_missing).
-export(['$handle_undefined_function'/2]).
'$handle_undefined_function'(Func, Args) ->
io:format("Called undefined function '~p' with args ~p.~n", [Func, Args]).
@dongyuwei
Copy link
Author

dongyuwei commented Jun 20, 2017

https://github.com/erlang/otp/blob/maint/lib/kernel/src/error_handler.erl#L139

test in erl shell

c(method_missing).
method_missing:foobar(1,2).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment