xref: /xiu/protocol/rtmp/src/utils/errors.rs (revision 06c50324)
1 use {
2     failure::{Backtrace, Fail},
3     std::fmt,
4 };
5 
6 #[derive(Debug)]
7 pub struct RtmpUrlParseError {
8     pub value: RtmpUrlParseErrorValue,
9 }
10 #[derive(Debug, Fail)]
11 pub enum RtmpUrlParseErrorValue {
12     #[fail(display = "The url is not valid\n")]
13     Notvalid,
14 }
15 
16 impl fmt::Display for RtmpUrlParseError {
17     fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
18         fmt::Display::fmt(&self.value, f)
19     }
20 }
21 
22 impl Fail for RtmpUrlParseError {
23     fn cause(&self) -> Option<&dyn Fail> {
24         self.value.cause()
25     }
26 
27     fn backtrace(&self) -> Option<&Backtrace> {
28         self.value.backtrace()
29     }
30 }
31