Stuff Goes Bad:Erlang In Anger

Side Effects

Of course, the libraries and processes that call such a client will then error out if they don’t expect to work without a database.
That’s an entirely different issue in a different problem space, one that depends on your business rules and what you can or can’t do to a client, but one that is possible to work around.
For example, consider a client for a service that stores operational metrics — the code that calls that client could very well ignore the errors without adverse effects to the system as a whole.
The difference in both initialization and supervision approaches is that the client’s callers make the decision about how much failure they can tolerate, not the client itself.
That’s a very important distinction when it comes to designing fault-tolerant systems.
Yes, supervisors are about restarts, but they should be about restarts to a stable known state.

 比如,考虑到一个存储众多运维指标(operational metrics)的client---client调用的代码就很可能忽略对整个系统产生不良影响的那些错误(因为正常情况下不会发现这种错误,对分析正常case没有帮助,并会扰乱正常情况)。