1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
//! Error handling.

use thiserror::Error;

/// Library errors.
#[derive(Error, Debug)]
#[error("caps error: {0}")]
pub struct CapsError(pub(crate) String);

impl From<&str> for CapsError {
    fn from(arg: &str) -> Self {
        Self(arg.to_string())
    }
}

impl From<String> for CapsError {
    fn from(arg: String) -> Self {
        Self(arg)
    }
}