sheave_core/messages/on_status/
publishing_failure.rs1use std::{
2 error::Error,
3 fmt::{
4 Display,
5 Formatter,
6 Result as FormatResult
7 },
8 io::{
9 Error as IOError,
10 ErrorKind
11 }
12};
13use crate::messages::amf::v0::Object;
14
15#[derive(Debug)]
17pub struct PublishingFailure(Object);
18
19impl PublishingFailure {
20 pub fn new(info_object: Object) -> Self {
22 Self(info_object)
23 }
24}
25
26impl Display for PublishingFailure {
27 fn fmt(&self, f: &mut Formatter<'_>) -> FormatResult {
28 writeln!(
29 f,
30 "Publishing failed. Code: {:?}, Description: {:?}",
31 self.0.get_properties().get("code"),
32 self.0.get_properties().get("description")
33 )
34 }
35}
36
37impl Error for PublishingFailure {}
38
39pub fn publishing_failure(info_object: Object) -> IOError {
41 IOError::new(
42 ErrorKind::Other,
43 PublishingFailure(info_object)
44 )
45}