Catch not found - abnormal program termination

Bjorn Gustavsson bjorn@REDACTED
Mon Jul 28 16:15:10 CEST 2003


I've found and fixed the compiler bug. The correction will
be included in R9C.

/Bjorn

Björn Bylander <bjorn@REDACTED> writes:

> Hi,
> 
> Given the module below and the function call
> "test_srv:start_link(foo)." from the Erlang shell, why does Erlang
> crash with "Catch not found"?
> It crashes for me under v5.2.3.3, Linux on an x86 and under v5.2,
> Windows 2000.
> Can anyone else reproduce it?
> 
> Björn Bylander
> 
> -module(test_srv).
> -behaviour(gen_server).
> -export([start_link/1]).
> -export([init/1, handle_call/3, handle_cast/2, handle_info/2,
> terminate/2, code_change/3]).
> 
> start_link(Param) ->
>     gen_server:start_link(?MODULE, Param, []).
> 
> init(Param) ->
>     process_flag(trap_exit, true),
>     (catch begin
>            foo(Param),
>            (catch exit(bar))
>        end
>     ),
>     ignore.
> 
> foo(_) -> ok.
> 
> handle_call(Call, From, State) -> {noreply, State}.
> handle_cast(Msg, State) -> {noreply, State}.
> handle_info(Msg, State) -> {noreply, State}.
> terminate(Reason, State) -> ok.
> code_change(OldVsn, State, Extra) -> {ok, State}.
> 
> 

-- 
Björn Gustavsson            Ericsson Utvecklings AB
bjorn@REDACTED      ÄT2/UAB/F/P
			    BOX 1505
+46 8 727 56 87 	    125 25 Älvsjö



More information about the erlang-questions mailing list