aboutsummaryrefslogtreecommitdiff
path: root/src/error.rs
blob: 0da2cf7b9314c3c226995a0f20ae1610a0ee68dc (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
use std::{error::Error, fmt::Display};

#[derive(Debug)]
pub struct WordTooLongError {
    word: String,
}

impl WordTooLongError {
    pub fn new(word: impl Into<String>) -> WordTooLongError {
        WordTooLongError { word: word.into() }
    }
}

impl Display for WordTooLongError {
    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
        f.write_fmt(format_args!(
            "The word \"{}\" is too long for the current terminal size",
            self.word
        ))
    }
}

impl Error for WordTooLongError {}
XMR address: 854DmXNrxULU3ZFJVs4Wc8PFhbq29RhqHhY8W6cdWrtFN3qmooKyyeYPcDzZTNRxphhJ5UzASQfAdEMwSteVqymk28aLhqj