Skip to content

Commit

Permalink
propagate iceoryx2 receiver error
Browse files Browse the repository at this point in the history
  • Loading branch information
dmackdev committed Nov 19, 2024
1 parent 3114df9 commit 52d3f04
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 6 deletions.
9 changes: 4 additions & 5 deletions src/input/source.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@ use super::{
speaker_notes::SpeakerNotesCommand,
user::{CommandKeyBindings, KeyBindingsValidationError, UserInput},
};
use crate::custom::KeyBindingsConfig;
use crate::{custom::KeyBindingsConfig, presenter::PresentationError};
use iceoryx2::{port::subscriber::Subscriber, service::ipc::Service};
use serde::Deserialize;
use std::{io, time::Duration};
use std::time::Duration;
use strum::EnumDiscriminants;

/// The source of commands.
Expand All @@ -30,10 +30,9 @@ impl CommandSource {
/// Try to get the next command.
///
/// This attempts to get a command and returns `Ok(None)` on timeout.
pub(crate) fn try_next_command(&mut self) -> io::Result<Option<Command>> {
pub(crate) fn try_next_command(&mut self) -> Result<Option<Command>, PresentationError> {
if let Some(receiver) = self.speaker_notes_event_receiver.as_mut() {
// TODO: Handle Err instead of unwrap.
if let Some(msg) = receiver.receive().unwrap() {
if let Some(msg) = receiver.receive()? {
match msg.payload() {
SpeakerNotesCommand::GoToSlide(idx) => {
return Ok(Some(Command::GoToSlide(*idx)));
Expand Down
8 changes: 7 additions & 1 deletion src/presenter.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
use iceoryx2::{
port::publisher::{Publisher, PublisherLoanError, PublisherSendError},
port::{
publisher::{Publisher, PublisherLoanError, PublisherSendError},
subscriber::SubscriberReceiveError,
},
service::ipc::Service,
};

Expand Down Expand Up @@ -502,4 +505,7 @@ pub enum PresentationError {

#[error(transparent)]
SpeakerNotesSend(#[from] PublisherSendError),

#[error(transparent)]
SpeakerNotesReceive(#[from] SubscriberReceiveError),
}

0 comments on commit 52d3f04

Please sign in to comment.