aboutsummaryrefslogtreecommitdiffstats
path: root/lib/stdlib/doc
diff options
context:
space:
mode:
authorLoïc Hoguin <[email protected]>2016-06-03 12:13:09 +0200
committerLoïc Hoguin <[email protected]>2016-10-31 16:01:48 +0200
commit798f09de48b1a7abe43d54d6fa0377ad15c3f6aa (patch)
treefd059ab2de87306752d1c85318f0c1bd8242fca6 /lib/stdlib/doc
parentc49194c9239c0dcad17b902b6638edf53bb69c6c (diff)
downloadotp-798f09de48b1a7abe43d54d6fa0377ad15c3f6aa.tar.gz
otp-798f09de48b1a7abe43d54d6fa0377ad15c3f6aa.tar.bz2
otp-798f09de48b1a7abe43d54d6fa0377ad15c3f6aa.zip
Propagate exceptions fully when using proc_lib
This makes proc_lib behaves like a normal process as far as the propagation of exceptions is concerned. Before this commit, the following difference could be observed: 6> spawn_link(fun() -> ssl:send(a,b) end). <0.43.0> 7> flush(). Shell got {'EXIT',<0.43.0>, {function_clause, [{ssl,send,[a,b],[{file,"..."},{line,275}]}]}} ok 8> proc_lib:spawn_link(fun() -> ssl:send(a,b) end). <0.46.0> 9> flush(). Shell got {'EXIT',<0.46.0>,function_clause} After this commit, we get the following instead: 3> flush(). Shell got {'EXIT',<0.61.0>, {function_clause, [{ssl,send,[a,b],[{file,"..."},{line,275}]}, {proc_lib,init_p,3,[{file,"..."},{line,232}]}]}} The stacktrace will show minor differences of course but the form is now the same as without proc_lib. The rationale behind this commit is that: * We now have a single form regardless of how the process was started * We can use the stacktrace to programmatically alter behavior (for example an HTTP server identifying problems in input decoding to send back a generic 400, or a 500 otherwise) * We can access the stacktrace to print it somewhere (for example an HTTP server could send it back to the client when a debug mode is enabled)
Diffstat (limited to 'lib/stdlib/doc')
-rw-r--r--lib/stdlib/doc/src/proc_lib.xml6
1 files changed, 6 insertions, 0 deletions
diff --git a/lib/stdlib/doc/src/proc_lib.xml b/lib/stdlib/doc/src/proc_lib.xml
index da03c39a26..e64b2ce18a 100644
--- a/lib/stdlib/doc/src/proc_lib.xml
+++ b/lib/stdlib/doc/src/proc_lib.xml
@@ -66,6 +66,12 @@
<seealso marker="sasl:error_logging">SASL Error Logging</seealso>
in the SASL User's Guide.</p>
+ <p>Unlike in "plain Erlang", <c>proc_lib</c> processes will not generate
+ <em>error reports</em>, which are written to the terminal by the
+ emulator and do not require SASL to be started. All exceptions are
+ converted to <em>exits</em> which are ignored by the default
+ <c>error_logger</c> handler.</p>
+
<p>The crash report contains the previously stored information, such
as ancestors and initial function, the termination reason, and
information about other processes that terminate as a result