A breach of contract is an error: A function is a unit of work. Thus, failures should be viewed as errors or otherwise based on their impact on functions. Within a function
f, a failure is an error if and only if it violates one of
f’s preconditions or prevents
f from meeting any of its callees’ preconditions, achieving any of
f’s own postconditions, or reestablishing any invariant that
f shares responsibility for maintaining.
In particular, here we exclude internal programming errors (i.e., where the caller and callee are the responsibility of the same person or team, such as inside a module), which are a separate category normally dealt with using assertions (see Item 68).