Add slide on Error trait and reorder error handling slides - #3283
Open
randomPoison wants to merge 1 commit into
Open
randomPoison wants to merge 1 commit into
randomPoison wants to merge 1 commit into
Conversation
- 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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR adds a new slide to the error handling section covering the
Errortrait and its related conventions for custom error types, and reorders the slides in the error handling section to flow a bit better:Errortrait. Currently we show theErrortrait 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 aboutErrormore directly.error conversion -> error trait -> thiserrorwhich allows us to gradually build up an understanding of how custom error types are defined before showing howthiserrorcan remove the boilerplate. We then dodynamic errors -> anyhowwhich I think flows well.ReadUsernameError::EmptyUsernameto make the example code easier to read. Specifically the linereturn 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.