SaveFailed(String),
}
-impl super::TopLevelErrorCandidate for AuthError {}
+impl super::top_level_error::TopLevelErrorCandidate for AuthError {}
impl std::fmt::Display for AuthError {
fn fmt(
Consistency(String), // just error message
}
-impl super::TopLevelErrorCandidate for ClientError {}
+impl super::top_level_error::TopLevelErrorCandidate for ClientError {}
impl From<reqwest::Error> for ClientError {
fn from(err: reqwest::Error) -> Self {
Env(std::env::VarError),
}
-impl super::TopLevelErrorCandidate for ConfigError {}
+impl super::top_level_error::TopLevelErrorCandidate for ConfigError {}
impl std::fmt::Display for ConfigError {
fn fmt(
pub mod posting;
pub mod scan_re;
pub mod text;
+pub mod top_level_error;
pub mod tui;
pub mod types;
-
-#[derive(Debug)]
-pub struct TopLevelError {
- prefix: String,
- message: String,
-}
-
-impl std::fmt::Display for TopLevelError {
- fn fmt(
- &self,
- f: &mut std::fmt::Formatter<'_>,
- ) -> Result<(), std::fmt::Error> {
- write!(f, "mastodonochrome: {}{}", self.prefix, self.message)
- }
-}
-
-trait TopLevelErrorCandidate: std::fmt::Display {
- fn get_prefix() -> String {
- "error: ".to_owned()
- }
-}
-
-impl<E: TopLevelErrorCandidate> From<E> for TopLevelError {
- fn from(err: E) -> Self {
- TopLevelError {
- prefix: E::get_prefix(),
- message: err.to_string(),
- }
- }
-}
-
-impl TopLevelErrorCandidate for clap::error::Error {
- // clap prints its own "error: "
- fn get_prefix() -> String {
- "".to_owned()
- }
-}
-
-impl TopLevelErrorCandidate for std::io::Error {}
use mastodonochrome::config::ConfigLocation;
use mastodonochrome::tui::Tui;
-use mastodonochrome::TopLevelError;
+use mastodonochrome::top_level_error::TopLevelError;
#[derive(Parser, Debug)]
struct Args {
--- /dev/null
+#[derive(Debug)]
+pub struct TopLevelError {
+ prefix: String,
+ message: String,
+}
+
+impl std::fmt::Display for TopLevelError {
+ fn fmt(
+ &self,
+ f: &mut std::fmt::Formatter<'_>,
+ ) -> Result<(), std::fmt::Error> {
+ write!(f, "mastodonochrome: {}{}", self.prefix, self.message)
+ }
+}
+
+pub trait TopLevelErrorCandidate: std::fmt::Display {
+ fn get_prefix() -> String {
+ "error: ".to_owned()
+ }
+}
+
+impl<E: TopLevelErrorCandidate> From<E> for TopLevelError {
+ fn from(err: E) -> Self {
+ TopLevelError {
+ prefix: E::get_prefix(),
+ message: err.to_string(),
+ }
+ }
+}
+
+impl TopLevelErrorCandidate for clap::error::Error {
+ // clap prints its own "error: "
+ fn get_prefix() -> String {
+ "".to_owned()
+ }
+}
+
+impl TopLevelErrorCandidate for std::io::Error {}
}
}
-impl super::TopLevelErrorCandidate for TuiError {}
+impl super::top_level_error::TopLevelErrorCandidate for TuiError {}
impl From<String> for TuiError {
fn from(message: String) -> Self {