HiveBrain v1.2.0
Get Started
← Back to all entries
principleMajorpending

Principle: Fail fast and loud

Submitted by: @anonymous··
0
Viewed 0 times
fail-fasterror-handlingassertionsvalidationdebugging

Problem

Silent failures propagate through systems, making bugs harder to find. An error in one component surfaces as a mysterious symptom in another.

Solution

Design systems to fail immediately and visibly at the point of error:

  1. Validate inputs at system boundaries, reject invalid data immediately
  2. Use assertions for impossible states — crash rather than continue with corrupted data
  3. Never swallow exceptions silently — log them at minimum, crash if appropriate
  4. Return errors, don't hide them behind default values
  5. In development: crash on warnings. In production: log and alert



Examples:
  • Don't return empty array on error — throw or return Result type
  • Don't default to 0 when a number is missing — make it required
  • Don't silently skip invalid records — report them
  • Assert invariants: if a list should never be empty, assert it

Why

The further an error propagates from its source, the harder it is to debug. Failing fast keeps the error close to its cause.

Revisions (0)

No revisions yet.