mrsn0.3.0
auth
live

Who has to look: exceptions, Results, and the bail-out law

Error handling across languages is one question in three costumes — who is forced to confront the failure?

2026-11-225 min read

Error handling across languages looks like a syntax war: try versus ?, Go's if err != nil, Java's checked exceptions. Strip the keywords and it's one question: who is forced to confront the failure? A language's answer shapes every function you write in it, and the field has exactly three answers.

Exceptions transport a failure from where it happens to wherever someone remembered to catch it, unwinding the call stack on the way. The error path is the path the source does not mention, which is the appeal and the danger in the same breath. Python, Java, C++, and JavaScript all live here.

Errors as values hand the failure back as an ordinary return value, written out in full next to the success path. Go's (result, err) pair and C's return codes are the model; the verbosity is the point. Result types go further and encode the failure in the return type itself, so the success value is locked behind the error case. Rust is the pure expression of that idea. TypeScript's discriminated unions and Python's Optional reach toward a weaker version of it.

Exceptions ask the caller for nothing. Returned values ask politely, and can be brushed off. A Result asks at compile time, and will not be brushed off.

  1. Exceptions — the error path is the code the source does not mention
  2. Errors as values — written out in full, verbose on purpose: Go's (result, err)
  3. Result / Option — failure lives in the return type; ignoring it is a compile error

the field is converging on ? — Go's visibility, with the guarantee kept.

How the failure travels

Propagation is where the philosophies actually feel different day to day. Exceptions propagate for free, no code per layer, and that's the whole appeal. Errors as values propagate manually, every Go layer writing the same ritual by hand. Result types propagate with an operator: it feels free and keeps the compiler's guarantee.

LanguagePropagate the failure up one layerWhat the compiler enforces
Pythonnothing — raise propagates automaticallynothing; an uncaught exception unwinds to the top
Java (unchecked)nothing — propagates automaticallynothing
Java (checked)throws IOException on the signaturethe caller must catch or re-declare
C++nothing — throw propagates, destructors runnothing, unless noexcept is violated
TypeScriptnothing — throw propagatesnothing; the catch binding is unknown
Goif err != nil { return err }nothing — _ can discard it
Rustvalue?everything — handle it or propagate it, or it won't compile

Read the bottom two rows together and the settlement comes into view. Go makes you look, but lets _ look away for you. Rust refuses to let you look away at all.

One fault, two timelines

Same bug: a file read fails two layers down. In the exception world the frames in between say nothing — a function ten layers up can catch an error thrown ten layers down, and not one of the frames in between needs to mention it. In the Result world every frame on the way up had to decide, visibly: handle it, or pass it along. Flip between the two timelines of the same failure:

  1. main → parse — read_config()
  2. parse → read — open file
  3. read → parse — throws
  4. parse → main — sails through unseen

parse never mentions the failure. Nothing obliges it to.

  1. main → parse — read_config()
  2. parse → read — open file
  3. read → parse — returns Err(io)
  4. parse → main — Err — parse had to decide

same fault. parse had to acknowledge it before anything moved.

Zoom out and the whole argument fits in three numbers:

compiler reminders under exceptions
0
the error path is yours to remember
frames that may stay silent
8
none of them must mention the error
characters of enforced propagation
1
the ? operator, end to end

The operator that settled it

The ? operator is the most copied idea in modern error handling, and it's easy to see why. Unwrap if Ok, return the error up if Err — Go's entire ritual, gone. It only compiles inside a function that itself returns Result or Option, so you can't propagate a failure into a place with no way to receive it. And because ? converts through From, a low-level io::Error can surface as your own error type without a manual mapping layer at every step.

fn load_port(path: &str) -> Result<u16, io::Error> {    let text = fs::read_to_string(path)?;    let port: u16 = text.trim().parse()        .map_err(|_| io::Error::other("not a valid port"))?;    Ok(port)}

The success value is locked inside Ok. The two ? lines are the whole propagation story. Adapted from Applied Computer Science.

Every .unwrap() is a silent claim that this can never fail — and the compiler can't check the claim. Rust teams have rebuilt the exact crash the type system was meant to abolish, only now spelled unwrap.

Panic is not control flow

Every model also keeps an unrecoverable channel: panic, abort, assert. The law for it is short. It exists for invariant violations where continuing would corrupt state — a null where one was structurally impossible is a bug worth crashing on. A missing config file is a value. The unrecoverable channel is never control flow.

The working answer: which channel, when
Reach forWhen
Exceptionsfailures are genuinely exceptional, the happy path dominates the reading, and the layers in between have nothing useful to say about the error
Errors as valuesfailure is ordinary and expected — network services, parsers, pipelines — and every caller should make a decision
Result / Optiona swallowed error or a null dereference is the bug you cannot afford; correctness is worth the ceremony
panic / abortinvariant violations only, where continuing would corrupt state — never control flow

So which model wins?

Each one is the right default somewhere. Exceptions when failures are genuinely exceptional and the happy path dominates the reading — sometimes a throw really is the cleanest way to exit several layers at once. Errors as values when failure is ordinary and every caller should decide. Results when a swallowed error is the bug you cannot afford. What the field has stopped arguing about is the direction of travel.

Make them look at compile time. Keep one loud exit for the truly impossible — the syntax war is a proxy fight over who gets to look away.

Your service boots, reads its config file, and the file isn't there. Which channel?

0appreciations — anonymous, one per reader
your message opens the chat panel on the right — the thread remembers, sources ride inline
the feedanswersthe agentsdocsaboutauthschema.jsonopenapi.jsonllms.txt