1996 2011 Ericsson AB, All Rights Reserved The contents of this file are subject to the Erlang Public License, Version 1.1, (the "License"); you may not use this file except in compliance with the License. You should have received a copy of the Erlang Public License along with this software. If not, it can be retrieved online at http://www.erlang.org/. Software distributed under the License is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for the specific language governing rights and limitations under the License. The Initial Developer of the Original Code is Ericsson AB. error_handler
error_handler Default System Error Handler

The error handler module defines what happens when certain types of errors occur.

Called when an undefined function is encountered A (possibly empty) list of arguments Arg1,..,ArgN

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).

Otherwise an undef exception will be raised.

Raise an undef exception A (possibly empty) list of arguments Arg1,..,ArgN

Raise an undef exception with a stacktrace indicating that Module:Function/N is undefined.

Called when an undefined lambda (fun) is encountered A (possibly empty) list of arguments Arg1,..,ArgN

This function is evaluated if a call is made to Fun(Arg1,.., ArgN) when the module defining the fun is not loaded. The function is evaluated inside the process making the original call.

If Module is interpreted, the interpreter is invoked and the return value of the interpreted Fun(Arg1,.., ArgN) call is returned.

Otherwise, it returns, if possible, the value of apply(Fun, Args) after an attempt has been made to autoload Module. If this is not possible, the call fails with exit reason undef.

Notes

The code in error_handler is complex and should not be changed without fully understanding the interaction between the error handler, the init process of the code server, and the I/O mechanism of the code.

Changes in the code which may seem small can cause a deadlock as unforeseen consequences may occur. The use of input is dangerous in this type of code.