</>CodexBash
All articles
Programming

Exceptions and error handling

How to handle errors well: exceptions versus error values, try, catch and finally, checked and unchecked exceptions in Java, Python's exception style, when to catch and when to let errors propagate, custom exceptions, cleaning up resources, retrying, error handling at API boundaries, and anti-patterns to avoid.

CodexBash, , 6 min read

Every real program fails sometimes: files are missing, networks time out, users type nonsense, databases reject writes. The difference between robust software and fragile software is rarely whether errors happen; it is how they are handled: whether failures are noticed, reported clearly, cleaned up after, and kept from corrupting data or leaking details to users. This article covers the mechanics of exceptions in common languages and, more importantly, the judgement of where and how to handle them.

Sign in to read the rest

The whole 6 minute article is free with an account, along with every problem, lesson and tutorial. No card.