Skip to content

Add slide on Error trait and reorder error handling slides - #3283

Open
randomPoison wants to merge 1 commit into
google:mainfrom
randomPoison:legare/error-tweaks
Open

randomPoison wants to merge 1 commit into
google:mainfrom
randomPoison:legare/error-tweaks

Conversation

@randomPoison

Copy link
Copy Markdown
Contributor

This PR adds a new slide to the error handling section covering the Error trait and its related conventions for custom error types, and reorders the slides in the error handling section to flow a bit better:

  • Split out slide on the Error trait. Currently we show the Error trait on the slide on error type conversions, but we don't actually do anything with it on that slide or discuss it in detail, so it mostly adds noise to the slide. Splitting that into its own slide allows the error conversion slide to be more focused and gives us a chance to talk about Error more directly.
  • Reorder slides to flow a bit better. The new order goes error conversion -> error trait -> thiserror which allows us to gradually build up an understanding of how custom error types are defined before showing how thiserror can remove the boilerplate. We then do dynamic errors -> anyhow which I think flows well.
  • Remove the string from ReadUsernameError::EmptyUsername to make the example code easier to read. Specifically the line return Err(ReadUsernameError::EmptyUsername(String::from(path))); was very verbose and I think that verbosity made it a bit hard to parse in a way that distracted from the point of the slide.

- Split out slide on the Error trait and the related conventions around defining a custom error type.
- Reorder slides to flow a bit better.
- Tweak some speaker notes to be more detailed.
@randomPoison randomPoison changed the title Rework error handling slides a bit Add slide on Error trait and reorder error handling slides Sep 18, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant