File tree Expand file tree Collapse file tree 1 file changed +5
-9
lines changed Expand file tree Collapse file tree 1 file changed +5
-9
lines changed Original file line number Diff line number Diff line change @@ -479,15 +479,11 @@ mod tests {
479479 //
480480 // 99 and 98 are just chosen as arbitrary valid domain ID values. There is
481481 // otherwise nothing special about either value.
482- let domain_id: usize = std:: env:: var ( "ROS_DOMAIN_ID" )
483- . ok ( )
484- . and_then ( |value| value. parse ( ) . ok ( ) )
485- . map ( |value : usize | if value != 99 { 99 } else { 98 } )
486- . unwrap_or ( 99 ) ;
487-
488- let context =
489- Context :: new_with_options ( [ ] , InitOptions :: new ( ) . with_domain_id ( Some ( domain_id) ) )
490- . unwrap ( ) ;
482+ let domain_id = env:: var ( "ROS_DOMAIN_ID" )
483+ . map_err ( |e| format ! ( "Failed to parse ROS_DOMAIN_ID: {}" , e) )
484+ . and_then ( |val| val. parse :: < usize > ( ) . map_err ( |e| format ! ( "{}" , e) ) )
485+ . map ( |id| if id != 99 { 99 } else { 98 } )
486+ . expect ( "Error setting domain_id" ) ;
491487 let node_name = "test_publisher_names_and_types" ;
492488 let node = Node :: new ( & context, node_name) . unwrap ( ) ;
493489 // Test that the graph has no publishers
You can’t perform that action at this time.
0 commit comments