-
Notifications
You must be signed in to change notification settings - Fork 2
Open
Description
Lots of places are using Box<dyn std::error::Error> for error types. It is kinda common pattern in rust applications, so that's generally fine, but instead of implementing everything from scratch, it is common to use anyhow crate for errors. It has exactly the same functionality, as Box<dyn std::error::Error>, but with more handy features, like custom errors, assertions, contexts, etc.
Also, there are quite a lot of places, which are using String as error type. This is really non-standard way, and should be replaced with normal errors.
What also needs to be fixed, are panics:
let mut new_historical_hashes = HistoricalBlockHashes::default();
for hash in &self.historical_block_hashes {
new_historical_hashes.push(*hash).expect("within limit"); // <-----
}So in general, you should never panic, unless there is some unique/impossible situation, that can never happen. So instead, you should do errors here, and handle them.
Metadata
Metadata
Assignees
Labels
No labels