-
Notifications
You must be signed in to change notification settings - Fork 9
Closed
Labels
enhancementNew feature or requestNew feature or request
Description
Is your feature request related to a problem? Please describe.
Error reporting is a big part in user interaction, thus it would be greatly beneficial to improve error handling.
As in:
- Removing as much
panic!or.unwrap/.expectas possible, both because panic is not a good error handling in Rust, as stated in Chapter 9: Error Handling of The Rust Book, and because panic error messages are generally hard to read for users - Providing as much useful information to the user in case of an error happening for helping them to fix it.
Describe the solution you'd like
- Use as much as possible
Resultwhen doing error-handling (up tomainwhich can return aResultbtw!):- Using
panic!/.unwrap/.expectonly when getting hard errors which cannot be handled in a sane way (defined as "unrecoverable errors")
- Using
- Use helpful crates for doing nice error-handling, with these ones as suggestions:
miette: Kind of a successor toanyhowand many other error-reporting crates, became one of the most used crates in this category for some time already and with many contributors/maintenance:Fancy diagnostic reporting library and protocol for us mere mortals who aren't compiler hackers
thiserror: A really helpful crate which help designing app-specific errors without the hassle of implementingErrorby hand, also integrate really fine withmiettetracing-error: Could be optional here, but it brings a nice bridge between thetracingcrate and error-handling code.
Additional context
Kind of a repetition, but the Rust Book chapter on error handling is a really good lecture: Chapter 9: Error Handling of The Rust Book
Metadata
Metadata
Assignees
Labels
enhancementNew feature or requestNew feature or request