Generic-user-small Alain O'Dea 18 posts

Compiling the code for my_alarm_handler.erl as is I get the following error:
./my_alarm_handler.erl:2: Warning: undefined callback function code_change/3 (behaviour ‘gen_event’)

I resolved this by adding another clause to the export statement:
Changing this:

-export([init/1, handle_event/2, handle_call/2,
         handle_info/2,  terminate/2]).

Into this:
-export([init/1, handle_event/2, handle_call/2,
         handle_info/2,  terminate/2, code_change/3]).

And adding code_change/3:

code_change(_OldVsn, State, _Extra) -> {ok, State}.

1 post, 1 voice