[erlang-questions] Best practices for handling invalid / unexpected messages

Daniel Dormont <>
Sun May 15 17:36:32 CEST 2011


On May 14, 2011, at 5:52 AM, Max Lapshin wrote:

> I always make
> 
> handle_call(Call, _From, State) ->
>  {stop, {invalid_call, Call}, State}.
> 
> as a last clause because it is a best way to know that _I_ haven't
> validated call in function, that make gen_server:call

Is this in a scenario where you're using an API? I think this is an area where I'm still confused about the Erlang design approach. Perhaps naively, I'd think that killing the entire gen_server process and losing its State is a pretty drastic response to an invalid call. I guess the real question is what's detecting the crash and what are they doing about it?

dan


More information about the erlang-questions mailing list