so, "let crash" mantra erlang code meant resistant cruel world events unexpected pulling plug, hardware failure, , unstable network connections.
on other hand, there defensive programming.
being new erlang, wonder, how know when want process crash , when want defend flow if
, case..of
, type guards?
say, have authentication module, can return true
/false
result if authenticated or not. should have successful scenario , crash if user authentication fails due wrong login/password?
what other scenarios, like, if product not found in database, or search results empty?
i suppose, can't ignore defensive constructs completely, guards in nature defend "normal" flow of app?
is there rule of thumb when defend , when crash?
as fred hebert says @ http://ferd.ca/the-zen-of-erlang.html -
if know how handle error, fine, can specific error. otherwise, let crash!
i'd authentication errors, empty search results, etc., expected errors , warrant appropriate response user.
Comments
Post a Comment