Work effectively with AI coding agents. Understand them as language models running in a tool loop with limited context, which is why they guess, game the visible signal and report confidently. Recognise the shortcut and correctness tells in their code across Python, TypeScript/JavaScript, Rust, Java and Go, and know the damage each one does later. Verify changes instead of trusting them, review diffs fast for quality and security, judge when work is truly finished, and choose, design and steer tasks so agents can finish them well.
Error handling idioms across languages card 3 of 6

Where errors go, language by language

**Rule:** handle an error only where you can act correctly, for example with a retry, a default the spec allows, a user message or an HTTP status. Everywhere else, propagate it with context. - **Python, JS/TS:** propagate by not catching. Ignore: `except: pass`, empty `catch {}`, `.catch(() => {})`. - **Java:** a checked exception must be caught or declared with `throws`. An unchecked one (`RuntimeException`) propagates without either. Ignore: empty `catch`. - **Rust:** propagate an `Err` from a `Result`, or a `None` from an `Option`, with `?`. Ignore: `let _ =`, `.ok()`. - **Go:** propagate with `return …, fmt.Errorf("x: %w", err)`. Ignore: `_` for err, or an err never checked.
Terms on this card
checked exception
A Java exception the compiler forces you to catch or declare with throws, e.g. IOException or SQLException.
unchecked
In Java, RuntimeException and its subclasses (and Error): the compiler does not force callers to catch or declare them.
RuntimeException
Java's base class for unchecked exceptions. They propagate without a throws declaration, and new RuntimeException(e) keeps e as the cause.
propagate
Pass an error up to the caller instead of dealing with it here, ideally adding context about what was being attempted.
Result
Rust type Result<T, E>: either Ok(value) or Err(error). The compiler warns if you ignore a returned Result.
Learn this step by step on Bytewise
Lesson goal: Compare exceptions (Python, Java checked and unchecked, JS/TS), Result/Option with ? (Rust) and error values (Go). For each, say where an error should be handled versus propagated and what 'ignoring' an error looks like. · the whole lesson