use std::{fmt, io};

#[derive(Debug, thiserror::Error)]
pub enum Error {
    // I/O errors
    #[error("Could not open file: {0}")]
    OpenError(io::Error),
    #[error("Could not write file: {0}")]
    WriteError(io::Error),
    #[error("Buffer does not have a path")]
    NoPath,
    #[error("Buffer has unsaved changes: {0}")]
    UnsavedBuffer(&'static str),
    #[error("Invalid command, usage: {0}")]
    InvalidCommand(&'static str),
    #[error("Unknown command: `{0}`")]
    UnknownCommand(String),
    #[error("Terminal error: {0}")]
    TerminalError(io::Error),
    #[error("Terminal error: {0:?}")]
    TerminalFmtError(fmt::Error),
}
