openskills.info
Course Preview

Error Handling

Error handling is the discipline of deciding what a program does when an operation cannot complete as expected. It covers structured mechanisms such as exceptions, returned error values, and cleanup clauses, plus the judgment of when to handle, wrap, translate, or propagate a failure so problems stay visible and recoverable.

itSoftware engineering

Error Handling

Every operation has preconditions: conditions under which it can complete normally. Error handling is what your program does when those conditions are violated. An error is not an accident — it is an outcome the code has to account for, and the discipline is deciding that account in advance instead of discovering it at runtime.

The goal is a program that fails clearly, cleans up after itself, and gives the next layer enough information to act. That means choosing the right mechanism, preserving context as an error moves up, and testing the failure paths with the same care as the happy path.

Errors are conditions, not surprises

An exception or an error value represents a violated precondition: an invalid argument, a missing file, an unavailable resource, or a routine that detected a condition requiring special handling. What counts as an error is a design decision. Division by zero can abort, return a sentinel value, or raise an exception — each choice changes what callers must do.

The word "exception" does not mean "rare". A lookup that misses its key may happen more often than a hit. Treat the error path as a first-class path: it has inputs, outputs, and behavior you can test.

Two families of mechanisms

Languages broadly offer two models, and some offer both:

Continue the course

This section is part of the paid course.

See pricing to subscribe, or log in if you already have access.

Where this skill leads

Relevant careers

See how this topic contributes to broader role-level skill maps.

Sources