<html><head><meta http-equiv="Content-Type" content="text/html charset=utf-8"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class=""><div class="">You’re correct.</div><div class="">To be able to use the result of gen_server:start_link you must be trapping exits.</div><div class="">I wrote <a href="https://medium.com/erlang-battleground/the-unstoppable-exception-9dfb009852f5" class="">a blog post</a> about it a while back.</div><div class="">Cheers!</div><br class=""><div><blockquote type="cite" class=""><div class="">On May 2, 2017, at 11:57, Max Lapshin <<a href="mailto:max.lapshin@gmail.com" class="">max.lapshin@gmail.com</a>> wrote:</div><br class="Apple-interchange-newline"><div class=""><div dir="ltr" class=""><br class=""><div class="">Here:  <a href="http://erlang.org/doc/man/gen_server.html#start_link-3" class="">http://erlang.org/doc/man/gen_server.html#start_link-3</a>  we can read that start_link will return  {error, Reason} if init callback returns {stop, Reason}</div><div class=""><br class=""></div><div class=""><br class=""></div><div class="">Maybe I'm wrong, but it seems that it is not possible to get back clean reply, because gen_server.erl  has following code:</div><div class=""><br class=""></div><div class="">proc_lib:init_ack(Starter, {error, Reason}),  % here we may receive error tuple</div><div class="">exit(Reason)  </div><div class=""><br class=""></div><div class="">After exit caller is failing because of linkage. So if we want to have start_link, we cannot get clean logs and clearly get {error, Reason}  tuple.</div><div class=""><br class=""></div><div class="">Am I wrong?</div></div>
_______________________________________________<br class="">erlang-questions mailing list<br class=""><a href="mailto:erlang-questions@erlang.org" class="">erlang-questions@erlang.org</a><br class="">http://erlang.org/mailman/listinfo/erlang-questions<br class=""></div></blockquote></div><br class=""></body></html>