If you can’t explain, for your particular application, why you want to crash (and restart into a known state) when an unexpected message is received, then IMHO, you should have that catch all handle_info
function that at least logs what it got. When I was first learning OTP, I got confused at messages I did and did not receive until it all clicked, and it’s only made worse if the GenServer is restarting in the middle of it all.
I think you should have the catch all handle_info
until you can explain why you do not want it.