sheave_client/handlers/
error_response.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 sheave_core::messages::amf::v0::Object;
14
15#[derive(Debug)]
17pub struct ErrorResponse(Object);
18
19impl ErrorResponse {
20 pub fn new(information: Object) -> Self {
22 Self(information)
23 }
24}
25
26impl Display for ErrorResponse {
27 fn fmt(&self, f: &mut Formatter<'_>) -> FormatResult {
28 writeln!(f, "_error response got handled.\ninformation: {:?}", self.0)
29 }
30}
31
32impl Error for ErrorResponse {}
33
34pub fn error_response(information: Object) -> IOError {
36 IOError::new(
37 ErrorKind::InvalidData,
38 ErrorResponse(information)
39 )
40}