#[derive(Debug, thiserror::Error)]
pub enum LooperError {
    #[error("Failed to parse command line arguments")]
    ArgsParse(&'static std::panic::Location<'static>),

    #[error("Failed to allocate new audio chunk")]
    ChunkAllocation(&'static std::panic::Location<'static>),

    #[error("Cannot modify chunk with multiple references")]
    ChunkOwnership(&'static std::panic::Location<'static>),

    #[error("Index out of bounds")]
    OutOfBounds(&'static std::panic::Location<'static>),

    #[error("Failed to send OSC message")]
    Osc(&'static std::panic::Location<'static>),

    #[error("Failed to load state")]
    StateLoad(&'static std::panic::Location<'static>),

    #[error("Failed to save state")]
    StateSave(&'static std::panic::Location<'static>),

    #[error("Failed to connect to JACK")]
    JackConnection(&'static std::panic::Location<'static>),

    #[error("Irrecoverable XRUN")]
    Xrun(&'static std::panic::Location<'static>),

    #[error("Failed to write midi message")]
    Midi(&'static std::panic::Location<'static>),
}

pub type Result<T> = std::result::Result<T, LooperError>;
