Skip to content

Improvement: Please improve error reporting in Rust API #165

@artemsheinacn

Description

@artemsheinacn

What

In particular, I have issues identifying the root cause of the error message:

DEBUG: Creating MW COM Producer for /feo/com/MiniAdasNeuralNet...
thread '<unnamed>' (870698) panicked at examples/rust/mini-adas/src/activities/components.rs:672:22:
can't offer a producer: Fail

produced by a call to offer method:

fn create_producer<I: Interface>(
    topic: &str,
) -> <<I as Interface>::Producer<LolaRuntimeImpl> as Producer<LolaRuntimeImpl>>::OfferedProducer {
    debug!("Creating MW COM Producer for {topic}...");
    let service_id = InstanceSpecifier::new(topic).expect("Failed to create InstanceSpecifier");
    let producer_builder = mw_com_runtime().producer_builder::<I>(service_id);
    let producer = producer_builder.build().unwrap();
    producer.offer().expect("can't offer a producer")
}

where "Fail" is produced by the offer_service method:

impl ProviderInfo for LolaProviderInfo {
    fn offer_service(&self) -> Result<()> {
        //SAFETY: it is safe as we are passing valid skeleton handle to offer service
        // the skeleton handle is created during building the provider info instance
        let status =
            unsafe { bridge_ffi_rs::skeleton_offer_service(self.skeleton_handle.0.handle) };
        if !status {
            return Err(Error::Fail);
        }
        Ok(())
    }

How

No response

Estimates for realization

A few distinct error codes will be a good start

Category

  • Affects Detailed Design

Requirements / Architecture

  • Requirements / Architecture are not affected by this change?

Metadata

Metadata

Labels

Type

Projects

Status

Backlog

Status

Backlog

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions