use std::io;
use audio_streams::BoxError;
use remain::sorted;
use thiserror::Error;
pub type Result<T> = std::result::Result<T, Error>;
#[sorted]
#[derive(Error, Debug)]
pub enum Error {
#[error(transparent)]
CreateStream(BoxError),
#[error(transparent)]
FetchBuffer(BoxError),
#[error("failed to generate stream source: {0}")]
GenerateStreamSource(BoxError),
#[allow(dead_code)]
#[error("invalid stream source: `{0}`")]
InvalidStreamSuorce(String),
#[error("mismatched x[] and y[] for linear regression")]
MismatchedSamples,
#[error("do not have enough samples")]
NotEnoughSamples,
#[error(transparent)]
SerdeError(#[from] serde_json::Error),
#[error(transparent)]
WriteBuffer(io::Error),
}