• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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 
5 use std::io;
6 
7 use audio_streams::BoxError;
8 use remain::sorted;
9 use thiserror::Error;
10 
11 pub type Result<T> = std::result::Result<T, Error>;
12 
13 #[sorted]
14 #[derive(Error, Debug)]
15 pub 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 }
35