Skip to content
public-library›Rules›Code design›Remove unnecessary error cases through contract design

Remove unnecessary error cases through contract design

Define ordinary cases as successful outcomes when they satisfy the operation's promised result, and preserve failures that prevent that result or carry information callers need. Make this choice in the contract before deciding which errors to handle internally.

In the full rule