1use bytesio::bits_errors::BitError;
2use failure::{Backtrace, Fail};
3use std::fmt;
4
5#[derive(Debug, Fail)]
6pub enum H264ErrorValue {
7 #[fail(display = "bit error")]
8 BitError(BitError),
9}
10#[derive(Debug)]
11pub struct H264Error {
12 pub value: H264ErrorValue,
13}
14
15impl From<BitError> for H264Error {
16 fn from(error: BitError) -> Self {
17 H264Error {
18 value: H264ErrorValue::BitError(error),
19 }
20 }
21}
22
23impl fmt::Display for H264Error {
24 fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
25 fmt::Display::fmt(&self.value, f)
26 }
27}
28
29impl Fail for H264Error {
30 fn cause(&self) -> Option<&dyn Fail> {
31 self.value.cause()
32 }
33
34 fn backtrace(&self) -> Option<&Backtrace> {
35 self.value.backtrace()
36 }
37}