summaryrefslogtreecommitdiffstats
path: root/src/utils
diff options
context:
space:
mode:
authorClement Tsang <34804052+ClementTsang@users.noreply.github.com>2020-03-08 13:56:18 -0400
committerGitHub <noreply@github.com>2020-03-08 13:56:18 -0400
commit01b37368b2dc4e458eea3d927986912aff5cc9a4 (patch)
tree7f2e1b4d1a4d49eff445b1ae4fd7718ac26b4290 /src/utils
parent226c4e5a681f66db7bf5a263804332d201ced98c (diff)
More basic cleaning (#74)
* Add htop link. * Move dd and help dialog into separate files * Move to folder * Properly show error message if DD fails on macOS and linux.
Diffstat (limited to 'src/utils')
-rw-r--r--src/utils/error.rs11
1 files changed, 11 insertions, 0 deletions
diff --git a/src/utils/error.rs b/src/utils/error.rs
index 3a0527e9..e8675f89 100644
--- a/src/utils/error.rs
+++ b/src/utils/error.rs
@@ -20,6 +20,8 @@ pub enum BottomError {
FernError(String),
/// An error to represent errors with the config.
ConfigError(String),
+ /// An error to represent errors with converting between data types.
+ ConversionError(String),
}
impl std::fmt::Display for BottomError {
@@ -42,6 +44,9 @@ impl std::fmt::Display for BottomError {
BottomError::ConfigError(ref message) => {
write!(f, "Invalid config file error: {}", message)
}
+ BottomError::ConversionError(ref message) => {
+ write!(f, "Unable to convert: {}", message)
+ }
}
}
}
@@ -87,3 +92,9 @@ impl From<fern::InitError> for BottomError {
BottomError::FernError(err.to_string())
}
}
+
+impl From<std::str::Utf8Error> for BottomError {
+ fn from(err: std::str::Utf8Error) -> Self {
+ BottomError::ConversionError(err.to_string())
+ }
+}