This function is called by the run-time system if a call is made to
Module:Function(Arg1,.., ArgN) and
Module:Function/N is undefined. Note that
undefined_function/3 is evaluated inside the process
making the original call.
This function will first attempt to autoload
Module. If that is not possible,
an undef exception will be raised.
If it was possible to load Module
and the function Function/N is exported,
it will be called.
Otherwise, if the function '$handle_undefined_function'/2
is exported, it will be called as
'$handle_undefined_function'(Function,
Args).
Defining '$handle_undefined_function'/2 in
ordinary application code is highly discouraged. It is very
easy to make subtle errors that can take a long time to
debug. Furthermore, none of the tools for static code
analysis (such as Dialyzer and Xref) supports the use of
'$handle_undefined_function'/2 and no such support
will be added. Only use this function after having carefully
considered other, less dangerous, solutions. One example of
potential legitimate use is creating stubs for other
sub-systems during testing and debugging.
Otherwise an undef exception will be raised.