audio_streams_conformance_test/
error.rs

1// Copyright 2022 The ChromiumOS Authors
2// Use of this source code is governed by a BSD-style license that can be
3// found in the LICENSE file.
4
5use std::io;
6
7use audio_streams::BoxError;
8use remain::sorted;
9use thiserror::Error;
10
11pub type Result<T> = std::result::Result<T, Error>;
12
13#[sorted]
14#[derive(Error, Debug)]
15pub enum Error {
16    /// Creating stream failed.
17    #[error(transparent)]
18    CreateStream(BoxError),
19    #[error(transparent)]
20    FetchBuffer(BoxError),
21    #[error("failed to generate stream source: {0}")]
22    GenerateStreamSource(BoxError),
23    #[allow(dead_code)]
24    #[error("invalid stream source: `{0}`")]
25    InvalidStreamSuorce(String),
26    #[error("mismatched x[] and y[] for linear regression")]
27    MismatchedSamples,
28    #[error("do not have enough samples")]
29    NotEnoughSamples,
30    #[error(transparent)]
31    SerdeError(#[from] serde_json::Error),
32    #[error(transparent)]
33    WriteBuffer(io::Error),
34}