[erlang-questions] gen_server and the run-time errors

Gilberto Carmenate García co7eb@REDACTED
Wed Dec 8 20:42:49 CET 2010


Hi, info

well, try to try catch the line
ets:insert(?MODULE,{Pid,0}),  <<<< this line provokes the shutdown
or simple catch

you got shutdown reason at the end because for the supervisor the only
matter is the gen_server final state so, and its state was shutdown
because any error was threw under its initialization, so to know and print
what error was try the try..catch clause 

try
    ets:insert(?MODULE,{Pid,0}),  <<<< this line provokes the shutdown
of

catch 
    Error:Reason->
        io:format("Error: ~p  Reason: ~p", [Error, Reason])
end.

or something like that.


Best,

Ivan.
-----Original Message-----
From: "info" <info@REDACTED>
To: "Gilberio_Carmenates_García" <co7eb@REDACTED>
Cc: "erlang-questions" <erlang-questions@REDACTED>
Date: Wed, 8 Dec 2010 17:51:13 +0100
Subject: Re: RE: [erlang-questions] gen_server and the run-time errors

> Hi,
> I have this ok !
> 
> init()->
> process_flag(trap_exit,true),
> handle_A(),
> {ok,0}.
> handle_A()->
> Pid=proc_lib:spawn_link(...),
> ets:insert(?MODULE,{Pid,0}),  <<<< this line provokes the shutdown
> ok.
> 
> I know my error but I would like to see on the screen the "Reason" and
> not "shutdown": I lost information somewhere !
> 
> J-Ph. Constantin
> ITS3 Genève
> www.its3.ch


=======================================================================
Este mensaje ha sido enviado mediante el servicio de correo electrónico que ofrece la Federación de Radioaficionados de Cuba a sus miembros para respaldar el cumplimiento de los objetivos de la organización y su política informativa. La persona que envía este correo asume el compromiso de  usar el servicio a tales fines y cumplir con las regulaciones establecidas.




More information about the erlang-questions mailing list