-
Notifications
You must be signed in to change notification settings - Fork 242
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor: migrate data collection and some others away from BottomErr…
…or (#1497)
- Loading branch information
1 parent
c56e283
commit 0401f52
Showing
13 changed files
with
124 additions
and
114 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
use anyhow::anyhow; | ||
|
||
/// An error to do with data collection. | ||
#[derive(Debug)] | ||
pub enum CollectionError { | ||
/// A general error to propagate back up. A wrapper around [`anyhow::Error`]. | ||
General(anyhow::Error), | ||
|
||
/// The collection is unsupported. | ||
Unsupported, | ||
} | ||
|
||
impl CollectionError { | ||
// pub(crate) fn general<E: Into<anyhow::Error>>(error: E) -> Self { | ||
// Self::General(error.into()) | ||
// } | ||
|
||
pub(crate) fn from_str(msg: &'static str) -> Self { | ||
Self::General(anyhow!(msg)) | ||
} | ||
} | ||
|
||
/// A [`Result`] with the error type being a [`DataCollectionError`]. | ||
pub(crate) type CollectionResult<T> = Result<T, CollectionError>; | ||
|
||
impl From<std::io::Error> for CollectionError { | ||
fn from(err: std::io::Error) -> Self { | ||
CollectionError::General(err.into()) | ||
} | ||
} |
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
Oops, something went wrong.