1error_handler(3) Erlang Module Definition error_handler(3)
2
3
4
6 error_handler - Default system error handler.
7
9 This module defines what happens when certain types of errors occur.
10
12 raise_undef_exception(Module, Function, Args) -> no_return()
13
14 Types:
15
16 Module = Function = atom()
17 Args = list()
18 A (possibly empty) list of arguments Arg1,..,ArgN
19
20 Raises an undef exception with a stacktrace, indicating that
21 Module:Function/N is undefined.
22
23 undefined_function(Module, Function, Args) -> any()
24
25 Types:
26
27 Module = Function = atom()
28 Args = list()
29 A (possibly empty) list of arguments Arg1,..,ArgN
30
31 This function is called by the runtime system if a call is made
32 to Module:Function(Arg1,.., ArgN) and Module:Function/N is unde‐
33 fined. Notice that this function is evaluated inside the process
34 making the original call.
35
36 This function first attempts to autoload Module. If that is not
37 possible, an undef exception is raised.
38
39 If it is possible to load Module and function Function/N is ex‐
40 ported, it is called.
41
42 Otherwise, if function '$handle_undefined_function'/2 is ex‐
43 ported, it is called as '$handle_undefined_function'(Function,
44 Args).
45
46 Warning:
47 Defining '$handle_undefined_function'/2 in ordinary application
48 code is highly discouraged. It is very easy to make subtle er‐
49 rors that can take a long time to debug. Furthermore, none of
50 the tools for static code analysis (such as Dialyzer and Xref)
51 supports the use of '$handle_undefined_function'/2 and no such
52 support will be added. Only use this function after having care‐
53 fully considered other, less dangerous, solutions. One example
54 of potential legitimate use is creating stubs for other sub-sys‐
55 tems during testing and debugging.
56
57
58 Otherwise an undef exception is raised.
59
60 undefined_lambda(Module, Fun, Args) -> term()
61
62 Types:
63
64 Module = atom()
65 Fun = function()
66 Args = list()
67 A (possibly empty) list of arguments Arg1,..,ArgN
68
69 This function is evaluated if a call is made to Fun(Arg1,..,
70 ArgN) when the module defining the fun is not loaded. The func‐
71 tion is evaluated inside the process making the original call.
72
73 If Module is interpreted, the interpreter is invoked and the re‐
74 turn value of the interpreted Fun(Arg1,.., ArgN) call is re‐
75 turned.
76
77 Otherwise, it returns, if possible, the value of apply(Fun,
78 Args) after an attempt is made to autoload Module. If this is
79 not possible, the call fails with exit reason undef.
80
82 The code in error_handler is complex. Do not change it without fully
83 understanding the interaction between the error handler, the init
84 process of the code server, and the I/O mechanism of the code.
85
86 Code changes that seem small can cause a deadlock, as unforeseen conse‐
87 quences can occur. The use of input is dangerous in this type of code.
88
89
90
91Ericsson AB kernel 8.5.4.2 error_handler(3)