def handle_info(_msg, state) do
{:noreply, state}
end
to handle unexpected messages received by GenServer. But such ignoring can result in ignoring developers’ errors. So, I guess, there can be reasons to crash early on unexpected messages. Or - at least - log them. But not ignoring.
I agree with your point. I would expect to at least log unexpected messages. I suspect the guides’ point is to get people started with minimal tangents. OTP has certain “housekeeping” sorts of messages that come into handle_info that doesn’t make a lot of sense to explain to someone brand new to the framework, and that in many cases you really should just ignore, but I agree with the idea to log them. That way you’ll be aware of them and can start seeing what they mean when you run across them.
Sorry. The default implementation for handle_info, which is the catch all
clause for unhandled messages will now log. If you provide your own
clauses, you need your own catch all and your own log though.
Aha, I see, thanks for the clarification! So, the default case will force a developer to notice “something else is happening”, and it is great. It is a motivation to recognize the reality…