Hello World
My first blog post about building a personal website with Rust and Axum.
Exploring idiomatic error handling in Rust — from Result types to custom error enums and the ? operator.
Written By Alinus Dumitrana
Jan 15, 2026 • 1 min read
Error handling is one of Rust's strongest features. Instead of exceptions, Rust uses the Result type to make error paths explicit and impossible to ignore.
Every fallible operation returns a Result<T, E>:
fn parse_config(path: &str) -> Result<Config, ConfigError> { let raw = std::fs::read_to_string(path)?; let config: Config = serde_yaml::from_str(&raw)?; Ok(config) }
For libraries and larger applications, defining custom error types gives callers clear information about what went wrong:
enum AppError { NotFound(String), ParseError(String), Internal(String), }
? OperatorThe question mark operator is syntactic sugar for early returns on errors. It makes the happy path clean and readable while still handling every error case.
unwrapIn production code, unwrap() should be reserved for cases where a failure is truly impossible — like parsing a known-valid constant. For everything else, propagate the error or provide a meaningful default.
My first blog post about building a personal website with Rust and Axum.
A deep dive into using Axum for server-side rendered websites with Askama templates and Tailwind CSS.