Two practical ways of error/exception handling

Better error/exception handling. 2 ways:
a) return status upwards the function calling chain and have the top calling function process the status;
b) not necessarily return the status but throw exception when something’s wrong, catch and process the exception in the top calling function or let the calling module catch it.
It’s better if we can combine these two methods effectively.

Instrumentation:
We should pay more attention on assert usage and make it a part of the error/exception handling mechanism.

原文地址:https://www.cnblogs.com/taoxu0903/p/745282.html