Get the latest tech news

Guide to Error Handling in Rust


Learn to model and handle every conceivable error scenario using idomatic Rust.

Forcing them to dig into your crate's error types, identify the possible culprits, downcast, and react dynamically screams "leaky implementation details". anyhow comes with a selection of macros, methods and blanket implementations to make wrapping and adding context to any Display + Send + Sync + 'static type a breeze. As a general rule, return only your own or standard library error types across crate boundaries to minimize leakage of your implementation details into other people's code.

Get the Android app

Or read this on Hacker News

Read more on:

Photo of Rust

Rust

Photo of error handling

error handling

Related news:

News photo

Techniques for safe garbage collection in Rust

News photo

Small Strings in Rust: smolstr vs. smartstring (2020)

News photo

Mimalloc Cigarette: Losing one week of my life catching a memory leak (Rust)