jobber 1.1.5-alpha

Minimalistic console work time tracker
use thiserror::Error;

#[derive(Debug, Error)]
pub(crate) enum Error {
    #[error("No Company")]
    NoCompany,
    #[error("Client '{0}' already exists")]
    ClientExists(String),
    #[error("Worker '{0}' already exists")]
    WorkerExists(String),
    #[error("Worker '{0}' not found")]
    WorkerNotFound(String),
    #[error("Client '{0}' not found")]
    ClientNotFound(String),
    #[error("Tag '{0}' not found")]
    TagNotFound(String),
    #[error("Tag '{0}' already exists")]
    TagExists(String),
    #[error("Unknown worker '{0}'")]
    UnknownWorker(String),
    #[error("Unknown client '{0}'")]
    UnknownClient(String),
    #[error("Job {0} not found")]
    JobNotFound(usize),
    #[error("Work {1} not found in job {0}")]
    WorkNotFound(usize, usize),
    #[error("Invoice {0} not found")]
    InvoiceNotFound(usize),
    #[error("Already working since {start} on {desc} for client {client}")]
    AlreadyWorking {
        start: String,
        desc: String,
        client: String,
    },
    #[error("Subject already existing: '{0}'")]
    DescriptionExists(String),
    #[error("Subject missing")]
    DescriptionMissing,
    #[error("Currently not working")]
    NotWorking,
    #[error("Work starts at {0} after it ends ay {1}.")]
    EndsBeforeStart(String, String),
    #[error("{0}")]
    Entity(#[from] crate::entities::Error),
    #[error("{0}")]
    Inquire(#[from] inquire::error::InquireError),
}
pub(crate) type Result<T> = std::result::Result<T, Error>;