1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
use std::path::PathBuf;

use snafu::prelude::*;

mod manager;
mod user;

pub use manager::UserManager;
pub use user::User;

#[derive(Debug, Snafu)]
pub enum UserError {
    #[snafu(display("The username could not be found"))]
    UsernameNotFound,
    #[snafu(display("IO Error: {source}"))]
    IoError { source: std::io::Error },
    #[snafu(display("Generation Error: {source}"))]
    GenerationError {
        source: crate::generation::GenerationError,
    },
    #[snafu(whatever, display("{message}"))]
    Whatever { message: String },
    #[snafu(display("Rusbreak {message}: {source}"))]
    RustbreakError {
        message: String,
        source: rustbreak::RustbreakError,
    },
    #[snafu(display("Path {path:#?} is not existing"))]
    PathNotExisting { path: PathBuf },
}

type UserResult<T> = Result<T, UserError>;