fn send_serial_response_error(sub_id: &String, sender: &mut Writer<TcpStream>, error: e::Error) {
  let error = e::to_serial_response_error(error);
  serde_json::to_string(&error)
    .map_err(|err| e::ErrorKind::Json(err))
    .map(|json| Message::text(json))
    .map(|msg| {
      sender
        .send_message::<Message, _>(&msg)
        .map_err::<e::Error, _>(|err| e::ErrorKind::SendWsMessage(err).into())
    })
    .unwrap_or_else(|_| {
      warn!("{}: Problem sending bad json error response", sub_id);
      Ok(())
    })
    .is_ok(); // This shouldn't be needed?
}
/// Send an error to the given subscriber
/// Log a warning if the message can't be sent
/// This is usually ok as it means the client
/// has simply disconnected
Send an error to the given subscriber
Log a warning if the message can't be sent
This is usually ok as it means the client
has simply disconnected
Send an error to the given subscriber Log a warning if the message can ' t be sent This is usually ok as it means the client has simply disconnected
fn send_serial_response_error(sub_id: &String, sender: &mut Writer<TcpStream>, error: e::Error) {
  let error = e::to_serial_response_error(error);
  serde_json::to_string(&error)
    .map_err(|err| e::ErrorKind::Json(err))
    .map(|json| Message::text(json))
    .map(|msg| {
      sender
        .send_message::<Message, _>(&msg)
        .map_err::<e::Error, _>(|err| e::ErrorKind::SendWsMessage(err).into())
    })
    .unwrap_or_else(|_| {
      warn!("{}: Problem sending bad json error response", sub_id);
      Ok(())
    })
    .is_ok(); // This shouldn't be needed?
}
fn send_serial_response_error ( sub_id : & String , sender : & mut Writer < TcpStream > , error : e :: Error ) { let error = e :: to_serial_response_error ( error ) ; serde_json :: to_string ( & error ) . map_err ( | err | e :: ErrorKind :: Json ( err ) ) . map ( | json | Message :: text ( json ) ) . map ( | msg | { sender . send_message :: < Message , _ > ( & msg ) . map_err :: < e :: Error , _ > ( | err | e :: ErrorKind :: SendWsMessage ( err ) . into ( ) ) } ) . unwrap_or_else ( | _ | { warn ! ( " " sub_id ) ; Ok ( ( ) ) } ) . is_ok ( ) ; // This shouldn't be needed? }
Send an error to the given subscriber
Log a warning if the message can't be sent
This is usually ok as it means the client
has simply disconnected
Send an error to the given subscriber Log a warning if the message can ' t be sent This is usually ok as it means the client has simply disconnected
sub_id
&String
sender
&mut Writer<TcpStream>
error
e::Error
sub_id
&String
sender
&mut Writer<TcpStream>
error
e::Error