[erlang-questions] proc_lib, throw, and nocatch

Scott Parish srp@REDACTED
Tue Jan 1 09:32:51 CET 2008


erlang(3) documents that 'throw(Any)' has a "Failure" condition of  
'nocatch' if the throw wasn't caught.

sasl's user guide 2.3 suggests that any process exit other then  
'normal' and 'shutdown' will have a report generated

proc_lib places a "catch" (as opposed to "try/catch") on the stack  
and then only creates an error report if the returned value matches  
'{'EXIT', Reason}'.

This means if i have a process (that i've spawned with proc_lib so  
that i get an error report) that does a 'throw()' that isn't caught,  
it's treated by proc_lib as a 'normal' exit. Nothing gets logged.  
Links get notified that the process exited 'normal'. Maybe i'm  
misunderstanding, but this is not the behavior i expected, nor what i  
understood from having read the documentation.

Would it be better if proc_lib were using the try/catch form so that  
it can distinguish between returned and thrown values and fail  
'nocatch' on the thrown ones?

Thanks
sRp



More information about the erlang-questions mailing list