Skip to content

Commit

Permalink
iox-#23 Use proper error handling for introspection
Browse files Browse the repository at this point in the history
  • Loading branch information
elBoberido committed Jun 25, 2022
1 parent bf15a0f commit 670612c
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
4 changes: 2 additions & 2 deletions src/introspection/memory/ffi.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
// SPDX-FileContributor: Mathias Kraus

use crate::sb::{InactiveSubscriber, SubscriberBuilder};
use crate::IceoryxError;

use std::ffi::CStr;
use std::marker::PhantomData;
Expand Down Expand Up @@ -123,12 +124,11 @@ pub struct MemPoolIntrospectionTopic {
}

impl MemPoolIntrospectionTopic {
pub fn new() -> InactiveSubscriber<Self> {
pub fn new() -> Result<InactiveSubscriber<Self>, IceoryxError> {
SubscriberBuilder::<Self>::new("Introspection", "RouDi_ID", "MemPool")
.queue_capacity(1)
.history_request(1)
.create_without_subscribe()
.expect("Create subscriber")
}

pub fn memory_segments(&self) -> MemorySegmentContainer {
Expand Down
4 changes: 2 additions & 2 deletions src/introspection/port/ffi.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
// SPDX-FileContributor: Mathias Kraus

use crate::sb::{InactiveSubscriber, SubscriberBuilder};
use crate::IceoryxError;

use std::ffi::CStr;
use std::os::raw::c_char;
Expand Down Expand Up @@ -164,12 +165,11 @@ pub struct PortIntrospectionTopic {
}

impl PortIntrospectionTopic {
pub fn new() -> InactiveSubscriber<Self> {
pub fn new() -> Result<InactiveSubscriber<Self>, IceoryxError> {
SubscriberBuilder::<Self>::new("Introspection", "RouDi_ID", "Port")
.queue_capacity(1)
.history_request(1)
.create_without_subscribe()
.expect("Create subscriber")
}

pub fn subscriber_ports(&self) -> SubscriberPortIntrospectionContainer {
Expand Down
4 changes: 2 additions & 2 deletions src/introspection/process/ffi.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
// SPDX-FileContributor: Mathias Kraus

use crate::sb::{InactiveSubscriber, SubscriberBuilder};
use crate::IceoryxError;

use std::ffi::CStr;
use std::os::raw::c_char;
Expand Down Expand Up @@ -60,12 +61,11 @@ pub struct ProcessIntrospectionTopic {
}

impl ProcessIntrospectionTopic {
pub fn new() -> InactiveSubscriber<Self> {
pub fn new() -> Result<InactiveSubscriber<Self>, IceoryxError> {
SubscriberBuilder::<Self>::new("Introspection", "RouDi_ID", "Process")
.queue_capacity(1)
.history_request(1)
.create_without_subscribe()
.expect("Create subscriber")
}

pub fn processes(&self) -> ProcessIntrospectionContainer {
Expand Down

0 comments on commit 670612c

Please sign in to comment.