Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 2 additions & 15 deletions src/cli_input.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@ use clap::Parser;
use colored::*;
use regex::Regex;
use si_unit_prefix::SiUnitPrefix;
use std::error::Error;
use std::fmt;
use std::num::ParseFloatError;

use crate::currencies::Currencies;
Expand Down Expand Up @@ -35,7 +33,8 @@ pub struct CliInput {
pub integer: bool,
}

#[derive(Debug)]
#[derive(Debug, thiserror::Error)]
#[error("{details}")]
pub struct InputError {
details: String,
}
Expand All @@ -48,18 +47,6 @@ impl InputError {
}
}

impl fmt::Display for InputError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.details)
}
}

impl Error for InputError {
fn description(&self) -> &str {
&self.details
}
}

impl From<ParseFloatError> for InputError {
fn from(err: ParseFloatError) -> Self {
Self::new(&err.to_string())
Expand Down
Loading