Skip to content
HomeVideosBooksBlogs
AllTop postsTopics
Podcasts
HistoryListsWatch laterLiked videosFollowing

The videos, books, blogs and podcasts Hacker News keeps recommending, all in one place.

VideosBooksBlogsPodcastsAboutPrivacySettings

Data from Hacker News, HackerTube, HackerBooks, HackerBlogs and Open Library. Credits · Not affiliated with Y Combinator.

HomeVideosBooksBlogsPodcasts
Ctrl K
    S

    Sabrina Jewson

    sabrinajewson.org · Personal blog · on HN since 2022

    Sabrina Jewson writes in-depth Rust articles on error handling, lifetimes, async design, and atomic orderings.

    Visit blogRSSHN submissions
    Languages & CompilersProgramming
    What HN says

    HN commenters recommend her Modular Errors in Rust post and point to it as a good approach to error types, including one error type per function.

    Stats for nerds
    15HN people shared it
    12linked in comments
    153story points
    Aug 2025last shared
    2022people per year2025

    Top posts on HN

    1. 1
      Async destructors, async genericity and completion futures
      2 people · 72 points · first shared 2022 · 21 comments on HN
    2. 2
      The Better Alternative to Lifetime GATs
      3 people · 46 points · first shared 2022 · 11 comments on HN
    3. 3
      "Hygienic" Let Statements in Rust
      1 person · 25 points · first shared 2024 · Discussion on HN
    4. 4
      Modular Errors in Rust
      6 people · 4 points · first shared 2023 · Discussion on HN
    5. 5
      Why the “Null” Lifetime Does Not Exist
      4 people · 4 points · first shared 2023 · Discussion on HN
    6. 6
      A new diagram-based explanation of Rust/C++20 atomic orderings
      1 person · 2 points · first shared 2022 · Discussion on HN

    What HN people wrote when they linked it

    • mananaysiempreMay 2023

      Jokes aside, I can think of a couple of differences:

      - For the longest time, languages with typed (“checked”) exceptions lacked any parametric polymorphism worth a damn. That made the typing... less than optimally useful, especially with fallible callbacks. Sum types can borrow all that from the existing language, and you’d feel intensely awkward if you tried to go with untyped errors there (it’s of course still possible, through Dynamic or interface
      {} or whatever Rust’s thing is).

      Though looking at the boilerplate fest that is the latest Rust (sum-types-based) error handling article posted here[1], I’m not entirely convinced the situation has improved. Perhaps open union types of some sort really are needed? That’s where the algebraic-effects languages seem to be going, anyway.

      - Exceptions are more strict about what you can do with them: you can return or you can bind, monadically speaking. If an exception was raised, everything stops until it’s caught. With sum types (concrete ones, not an abstract error monad you can’t run), you are allowed to have several propagation chains at once and manipulate them as data. The lack of that additional flexibility is what makes exceptions (more cheaply?) implementable in terms of stack unwinding.

      (Traditionally, stack unwinding is thought of as expensive, but I don’t really see why. Sure SJLJ-induced register spills are bad, and sure table-based unwinding is slow as hell, but a linked list of frames as in Win32 SEH[2] has to be…

    • legerdemainMay 2022

      Also in Rust, you have combinations of existing and upcoming language features that make certain conceptually simple designs either outright impossible to implement, or only possible to implement a subset of due to certain barely documented compiler quirks, or impossible to determine whether it is actually possible to implement them without sinking hours of time into dead-end prototyping attempts.

      Like, not "Rust doesn't do this," but "there's a 50% chance that Rust can do this, but it might turn out to be impossible after all, and absolutely no one can tell which is which, because the language is just barely not expressive enough, or the compiler doesn't analyze this particular case, and might not until both the borrow checker and the type system receive complete rewrites."

      And this, in turn, kind of explains why the Rust standard library and especially the Rust compiler are swimming not just in unsafe code blocks, but code that uses features so unstable and private that you can't even enable them with flags on nightly builds.

      [0] https://github.com/rust-lang/rust/pull/96709#issuecomment-1118275010
      [1] https://sabrinajewson.org/blog/the-better-alternative-to-lifetime-gats

    • mplanchardDec 2024

      We actually went through the same realization when we started writing Rust a few years ago. The `thiserror` crate makes it easy to just wrap and return an error from some third-party library, like:

      #[derive(Debug, thiserror::Error)] enum MyError { #[error(transparent)] ThirdPartyError(#[from] third_party::Error) } Since it derives a `From` implementation, you can use it as easily as:

      fn some_function() -> Result<(), MyError> { third_party::do_thing()?; } But if that's happening somewhere deep in your application and you call that function from more than one place, good luck figuring out what it is! You wind up with an error log like `third_party thing failed` and that's it.

      Generally, we now use structured error types with context fields, which adds some verbosity as specifying a context becomes required, but it's a lot more useful in error logs. Our approach was significantly inspired by this post from Sabrina Jewson: https://sabrinajewson.org/blog/errors

    • conaclosAug 2025

      The following articles may also be of interest to the audience:

      - The definitive guide to error handling in Rust [0]

      - Error Handling for Large Rust Projects - Best Practice in GreptimeDB [1]

      - Designing error types in Rust [2]

      - Modular Errors in Rust [3]

      [0]: https://www.howtocodeit.com/articles/the-definitive-guide-to-rust-error-handling [1]: https://greptime.com/blogs/2024-05-07-error-rust [2]: https://mmapped.blog/posts/12-rust-error-handling [3]: https://sabrinajewson.org/blog/errors

    • ExpurpleJun 2025

      > I create one error type per function/action. I discovered this here on HN after an article I cannot find right now was posted.

      It could be this one: https://sabrinajewson.org/blog/errors

    • epageJul 2023

      I appreciated the approach in https://sabrinajewson.org/blog/errors

    Related

    Rust Blogblog.rust-lang.org533 people

    Announcing Rust 1.0

    Rust Blog
    Company · last shared 2026
    Niko Matsakissmallcultfollowing.com221 people

    Towards a Rust Foundation

    Niko Matsakis
    Personal · last shared 2026
    Miguel Young de la Sotamcyoung.xyz37 people

    The Rust calling convention we deserve

    Miguel Young de la Sota
    Personal · last shared 2026
    purplesyringapurplesyringa.moe39 people

    WebP: The WebPage Compression Format

    purplesyringa
    Personal · last shared 2026
    GreptimeDB Bloggreptime.com26 people

    Error Stacking in Rust

    GreptimeDB Blog
    Company · last shared 2026
    Tweede Golf Blogtweedegolf.nl38 people

    Rust is rolling off the Volvo assembly line

    Tweede Golf Blog
    Company · last shared 2026
    without.boatswithout.boats80 people

    Pin

    without.boats
    Personal · last shared 2026
    Aaron Turonaturon.github.io49 people

    Zero-cost futures in Rust

    Aaron Turon
    Personal · last shared 2025