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 2 of 6
Handle, pass up, or drop
Every call that can fail forces a choice: handle the error here, pass it to the caller, or drop it. Java checked exceptions, Rust's `Result` and Go's `err` make that choice visible, and the compiler or a linter nags until you make it. Asked to make the build pass, the agent often takes the cheapest choice: drop. It compiles, and tests on good data stay green. **Later cost:** the program runs on with null or empty data and fails far away, with the cause lost.
Terms on this card
- checked exceptions
- Java exceptions (subclasses of Exception but not RuntimeException) that the compiler forces you to catch or declare with throws.
- Result
- Rust type Result<T, E>: either Ok(value) or Err(error). The compiler warns if you ignore a returned Result.
- linter
- A tool that statically flags suspicious code, such as unchecked errors, beyond what the compiler rejects.
- the agent
- The AI coding system doing the work: a chat assistant, IDE agent or terminal agent.
- green
- A test or check that passes.
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