Errors, Resources, and Reliable Code

  1. Raising an Error with a Clear Meaning

    A raised error tells a caller that the promised operation could not complete normally. Its type and context help identify the next useful action.

    Undergraduate
  2. Catching an Exception Near Its Source

    An exception handler is easier to reason about when its protected block contains only the operation whose expected error it will translate.

    Undergraduate
  3. Exception Propagation Across Function Calls

    An exception that is unhandled in one call can travel to a caller able to handle it. Pending normal work along the way may be abandoned.

    Undergraduate
  4. Cleanup with Finally

    A finally block attempts cleanup on both ordinary and exceptional exits from a protected operation, subject to how the program and runtime exit.

    Undergraduate
  5. Acquiring and Releasing Several Resources

    When several resources have nested lifetimes, release them in an order consistent with their dependencies.

    Undergraduate
  6. When Cleanup Fails After Another Error

    A failed cleanup can add a second diagnostic after a primary operation has already failed. The result should keep enough context to explain both.

    Undergraduate
  7. Temporary and Permanent Failures

    A retry policy needs to know whether repeating the same operation with the same inputs might succeed without an unrelated change.

    Undergraduate
  8. Fitting Retries Within a Total Deadline

    Several attempts and their waits must fit the caller's deadline if the operation promises a bounded elapsed time.

    Undergraduate
  9. Backoff and Jitter for Retried Work

    Backoff can space out attempts after failures. Jitter can distribute those attempts so clients do not all resume at the same instant.

    Undergraduate
  10. Timeouts and Unknown Outcomes

    A timed-out caller can know it stopped waiting without knowing whether the requested operation completed on the other side.

    Undergraduate
  11. Tracking Work Completed Before a Failure

    When an operation consists of several effects, failure can leave some already completed. Record which steps actually happened before choosing recovery.

    Undergraduate
  12. Collecting Several Validation Errors

    Independent input errors can be reported together when each check has sufficient valid data to run.

    Undergraduate
  13. Failing Early on Invalid Configuration

    Configuration errors are easier to diagnose when checked before an application begins unrelated work using assumptions about the settings.

    Undergraduate
  14. Fallbacks That Signal Reduced Functionality

    A fallback can preserve part of a feature when the preferred data is unavailable. Its result should communicate any lost freshness or confidence.

    Undergraduate
  15. Checking an Invariant at a Component Boundary

    A boundary check can identify invalid state before another component assumes it is usable.

    Undergraduate
  16. Closing a Resource More Than Once

    An interface should state whether repeat cleanup succeeds safely, reports an already-closed state, or is outside its supported use.

    Undergraduate
  17. Resource Lifetime When Ending Iteration Early

    A consumer may stop before a source is exhausted. Cleanup must still occur according to who owns the underlying resource.

    Undergraduate
  18. Cooperative Cancellation of a Task

    A cancellation request can ask an ongoing operation to stop at a point where its state remains valid and cleanup is still possible.

    Undergraduate
  19. Handling a Repeated Event

    A processing system may receive the same event more than once. Applying it safely depends on its identity and the effect it requests.

    Undergraduate
  20. Counting Outcomes in a Reliable Operation

    An operation can track successes, expected rejections, and processing failures separately so monitoring explains how inputs moved through the system.

    Undergraduate
  21. Turning a Known Error into a Structured Result

    An interface can translate a well-understood error into fields used by callers while allowing unexpected failures to keep their diagnostic context.

    Undergraduate
  22. Preserving User Input After an Ordinary Error

    A recoverable validation or write error should leave relevant user input available when the user can correct and submit it again.

    Undergraduate
  23. Error Codes and Human-Readable Messages

    A stable code lets software branch on a result. A message explains the condition to a reader and can change with language or context.

    Undergraduate
  24. Marking a Result as Stale

    A useful result can be older than the consumer expects. Record the relevant observation time or freshness status explicitly so it can be used appropriately.

    Undergraduate
  25. Recovering an Export Interrupted Before Publication

    A restart can distinguish completed output from temporary work when publication is an explicit step with an identifiable result.

    Undergraduate
  26. Recording a Checkpoint for Resumable Work

    A checkpoint describes what work was committed so a restart can resume at a coherent boundary.

    Undergraduate
  27. Resource Limits in an Interface Contract

    A limit tells callers which inputs can be handled predictably. It needs a unit and a defined outcome at the boundary.

    Undergraduate
  28. Invariants for a Work Queue

    A queue operation should preserve counts, ordering, and which identities can still be processed even when a worker reports failure.

    Undergraduate
  29. Diagnostic Context Without Copying Private Data

    Operational diagnostics should include a location and failure reason while avoiding unnecessary copies of private or sensitive inputs.

    Undergraduate
  30. Testing a Recovery Path with an Ordinary Simulated Failure

    Inject a controlled failure into a dependency to check the state and result after an incomplete operation.

    Undergraduate