Articles tagged #errors

Page 1
The thumbnail for this page

Improving error handling - panics vs. proper errors

Nov 21, 2019
21 min #rust · #errors

Before we move on to parsing more of our raw packets, I want to take some time to improve our error handling strategy.

Currently, the ersatz codebase contains a mix of Result<T, E>, and some methods that panic, like unwrap() and expect().

We also have a custom Error enum that lets us return rawsock errors, IO errors, or Win32 errors:

pub enum Error { Rawsock(rawsock::Error), IO(std::io::Error), Win32(u32), }
Read more
Page 1

Go back to the homepage.

Ko-fi GitHub Sponsors Patreon
Bluesky Mastodon YouTube
TikTok Instagram RSS
About Legal Notice Privacy Policy Terms and Conditions