Skip to content
tezvyn:

Error Handling

56 bites tagged Error Handling — interview questions with model answers, and 60-second explainers.

Content & Copywriting2 min read

How would you implement specific error messages for failed validation rules?

Error codes from validators, a mapping layer separating logic from copy, and accessible inline rendering. Architecting validation as structured data instead of booleans.

Android & Kotlin2 min read

How do you differentiate network and server errors in suspend functions?

Catch IOException for connectivity and HttpException for HTTP errors; wrap in a sealed Result. Structured error handling in coroutines and mapping exceptions to recovery. Catching Exception or exposing raw errors to UI.

React & Next.js2 min read

React Error Boundaries: Containing UI Crashes

An Error Boundary is like a try...catch block for React components, preventing a single UI crash from breaking your whole app. Use it to wrap components that might fail, showing a fallback UI instead of a white screen.

Python & FastAPI2 min read

FastAPI: Use HTTPException to Return Client Errors

FastAPI's HTTPException is your tool for stopping an operation and sending a clean HTTP error. Raise it when business logic fails, like a missing database record. The footgun is catching it yourself; just `raise` it and let FastAPI do the rest.

Node.js & Express2 min read

Node.js Uncaught Exceptions: Clean Up, Don't Continue

An uncaught exception is a fire alarm for your Node.js app, signaling an unknown state. Use the `process.on('uncaughtException')` hook for last-resort synchronous cleanup before exiting, not to resume normal operation.

Node.js & Express2 min read

Custom Error Classes: Beyond Generic Errors

Create specific error types, like `NotFoundError`, instead of generic ones. This lets your code react differently to different failures, like sending a 404 for a missing user vs. a 500 for a database outage.

Go & Rust2 min read

Rust's Question Mark Operator (?): Propagate Errors, Not Boilerplate

The `?` operator cleans up Rust error handling by propagating `Err` values. Instead of a verbose `match` block, you append `?` to a `Result` or `Option`, and it automatically returns the error if present, letting you focus on the happy path.

Go & Rust2 min read

Rust's Option<T>: Handling Absence Safely

Rust's Option<T> is a type-safe box that holds either a value (Some(T)) or nothing (None), eliminating null pointer errors. Use it for function returns that might fail or for optional struct fields. The footgun is `.unwrap()`, which panics on None.

Get Error Handling bites daily.

Five a day, five minutes, offline. With quizzes so it sticks.

Open testing — you’ll join as an early tester.