diff options
author | Loïc Hoguin <[email protected]> | 2016-06-03 12:13:09 +0200 |
---|---|---|
committer | Loïc Hoguin <[email protected]> | 2016-10-31 16:01:48 +0200 |
commit | 798f09de48b1a7abe43d54d6fa0377ad15c3f6aa (patch) | |
tree | fd059ab2de87306752d1c85318f0c1bd8242fca6 /lib/parsetools | |
parent | c49194c9239c0dcad17b902b6638edf53bb69c6c (diff) | |
download | otp-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/parsetools')
0 files changed, 0 insertions, 0 deletions