1 use {crate::chunk::errors::PackError, failure::Fail, flv::errors::TagParseError}; 2 3 #[derive(Debug, Fail)] 4 pub enum CacheErrorValue { 5 #[fail(display = "tag parse error")] 6 TagParseError(TagParseError), 7 #[fail(display = "pack error")] 8 PackError(PackError), 9 } 10 11 pub struct CacheError { 12 pub value: CacheErrorValue, 13 } 14 15 impl From<TagParseError> for CacheError { 16 fn from(error: TagParseError) -> Self { 17 CacheError { 18 value: CacheErrorValue::TagParseError(error), 19 } 20 } 21 } 22 23 impl From<PackError> for CacheError { 24 fn from(error: PackError) -> Self { 25 CacheError { 26 value: CacheErrorValue::PackError(error), 27 } 28 } 29 } 30 31 #[derive(Debug, Fail)] 32 pub enum MetadataErrorValue { 33 #[fail(display = "tag parse error")] 34 TagParseError(TagParseError), 35 #[fail(display = "pack error")] 36 PackError(PackError), 37 } 38 39 pub struct MetadataError { 40 pub value: CacheErrorValue, 41 } 42