Permalink
Browse files

Add logic to catch when callback module returns bad initial state

  • Loading branch information...
bigkevmcd committed Jan 10, 2011
1 parent 803c8e2 commit d732113aa17efe05f8c49255cb771169a58922d6
Showing with 3 additions and 1 deletion.
  1. +3 −1 src/gen_nb_server.erl
View
@@ -130,8 +130,10 @@ init([CallbackModule, InitParams]) ->
process_flag(trap_exit, true),
State = #state{cb=CallbackModule},
case CallbackModule:init(InitParams, State) of
- {ok, ServerState} ->
+ {ok, ServerState} when is_record(ServerState, state) ->
{ok, ServerState};
+ {ok, _State} ->
+ {error, bad_init_state};
Err ->
Err
end.

0 comments on commit d732113

Please sign in to comment.