Files
artcraft/src/error.rs
T
Brandon Thomas f90fe671ff Synthesis with phonemes
Changes the filesystem structure a bit, introduces new wave file
reader and dictionaries, etc.
2016-08-24 03:03:21 -04:00

36 lines
812 B
Rust

// Copyright (c) 2016 Brandon Thomas <bt@brand.io, echelon@gmail.com>
use hound::Error as HoundError;
use std::convert::From;
use std::error;
use std::fmt;
use std::io;
/** The common error type used throughout the synthesizer. */
#[derive(Debug)]
pub enum SynthError {
/// Bad user input.
BadInput { description: &'static str },
/// The file was empty or did not have parsable contents.
EmptyFile,
/// Wraps an IoError.
IoError { cause: io::Error },
/// Wraps a Hound audio library error.
AudioError { cause: HoundError },
}
impl From<io::Error> for SynthError {
fn from(error: io::Error) -> SynthError {
SynthError::IoError { cause: error }
}
}
impl From<HoundError> for SynthError {
fn from(error: HoundError) -> SynthError {
SynthError::AudioError { cause: error }
}
}