Catch not found - abnormal program termination

Björn Bylander bjorn@REDACTED
Fri Jul 25 16:31:03 CEST 2003


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}.





More information about the erlang-questions mailing list