Changeset 127:82d5f97a74ea in finroc_plugins_data_ports


Ignore:
Timestamp:
22.09.2017 01:39:30 (22 months ago)
Author:
Max Reichardt <mreichardt@…>
Branch:
17.03
Phase:
public
Message:

Makes type conversion port connectors catch exceptions encountered during type conversion and output a respective warning message

File:
1 edited

Legend:

Unmodified
Added
Removed
  • common/tConversionConnector.cpp

    r119 r127  
    8484void tConversionConnector::Publish(const rrlib::rtti::tGenericObject& input_data, tChangeStatus change_constant) const 
    8585{ 
    86   tGenericPort& generic_port = const_cast<tGenericPort&>(reinterpret_cast<const tGenericPort&>(destination_port_generic_memory[0])); 
    87   tPortDataPointer<rrlib::rtti::tGenericObject> buffer = generic_port.GetUnusedBuffer(); 
    88   conversion_operation.Convert(input_data, *buffer); 
    89   generic_port.BrowserPublish(buffer, true, change_constant); 
     86  try 
     87  { 
     88    tGenericPort& generic_port = const_cast<tGenericPort&>(reinterpret_cast<const tGenericPort&>(destination_port_generic_memory[0])); 
     89    tPortDataPointer<rrlib::rtti::tGenericObject> buffer = generic_port.GetUnusedBuffer(); 
     90    conversion_operation.Convert(input_data, *buffer); 
     91    generic_port.BrowserPublish(buffer, true, change_constant); 
     92  } 
     93  catch (const std::exception& e) 
     94  { 
     95    FINROC_LOG_PRINT_STATIC(WARNING, "Converting data failed between ports '", Source(), "' and '", Destination(), "': ", e); 
     96  } 
    9097} 
    9198 
Note: See TracChangeset for help on using the changeset viewer.