Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/main'
Browse files Browse the repository at this point in the history
  • Loading branch information
simsekgokhan committed Dec 14, 2023
2 parents 76738f0 + 00c2752 commit 8a7605d
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion best-practices/readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -78,4 +78,9 @@ For this situation, an if let expression is one line shorter and, more important

// a.
Consider using David Tolnay's `anyhow` crate for error handling in applications.



// b. Libraries versus Applications
Code that's written for a library can't predict the environment in which the code is used, so it's preferable to emit concrete, detailed error information, and leave the caller to figure out how to use that information. This leans towards the enum-style nested errors described previously (and also avoids a dependency on anyhow in the public API of the library.


0 comments on commit 8a7605d

Please sign in to comment.