METABYTE
Back to articles

Two Kinds of Error: One's a Bug, the Other's a Surprise

Developers divide errors into two types: those you can fix and those you must accept.

9 mai 20262 min read
Two Kinds of Error: One's a Bug, the Other's a Surprise

Developers divide errors into two types: those you can fix and those you must accept.

Error vs. Error

In programming, there are two fundamentally different kinds of errors. The first is a bug: you wrote something wrong, and the program crashes. The second is uncertainty: you can't predict what the user will input or what the API will return. The first is your fault, the second is reality.

How to tell them apart?

  • Bug: TypeError: undefined is not a function. You forgot to check if the object exists.
  • Surprise: the user entered an emoji in the credit card number field. You didn't expect it, but it's not a bug — it's life.

Many junior developers try to handle every possible scenario, turning code into a fortress with a hundred ifs. But the truth is, some errors just need to be logged and moved on. Otherwise, your code becomes like assembling IKEA furniture without instructions — you keep adding pieces until you run out of screws.

What to do?

  • For bugs: tests, code reviews, monitoring.
  • For surprises: input validation, fallback values, and accepting you're not omniscient.

METABYTE studio comment: We love catching bugs too, but user surprises are a whole different art. Want fewer surprises? Let's chat about validation and error handling on our next call — coffee's on us.

NEXT STEP

Liked the approach?

We apply the same principles to client projects: AI, automation, products that don't die after launch.