Tech News
← Back to articles

The Two Kinds of Error

read original related products more articles

The two kinds of error

In short: in my mind, errors are divided into two categories. Expected errors (think “user entered invalid data”), which are part of normal operation, aren’t the developer’s fault, and should be handled. Unexpected errors (think “null pointer exception”) are the developer’s fault, likely indicate a bug, and are allowed to crash.

Error handling is an important, but often neglected, part of programming and user experience.

Over the years, I’ve developed an opinion about the two types of error in software. This is primarily informed by a career in web and application development, but I hope these learnings are widely applicable.

In my mind, errors are divided into two categories: expected and unexpected.

Expected errors

Expected errors happen during normal operation. Examples:

Validation errors when the user enters invalid data. You can’t control what the user types!

Network errors when the user’s network fails. It’s not your fault if the user turns their Internet off or has a slow connection!

Permission errors when your program isn’t allowed to do something. You can’t magically read forbidden files, fix a user’s password, or steal webcam privileges!

... continue reading