ros2 / examples

Example packages for ROS 2
Apache License 2.0
691 stars 311 forks source link

add try&catch statement to unique network flow publisher example. #313

Closed fujitatomoya closed 3 years ago

fujitatomoya commented 3 years ago

address https://github.com/ros2/examples/issues/312

Signed-off-by: Tomoya Fujita Tomoya.Fujita@sony.com

fujitatomoya commented 3 years ago

CI:

fujitatomoya commented 3 years ago

I suggest to narrow the scope of the try block and start it just before the line with comment "Get network flow endpoints" as shown below.

yeah, i thought that would be good enough as example. but create_publisher also possibly generates exception RCLError so i think the current code would be better to be in principle.

anamud commented 3 years ago

yeah, i thought that would be good enough as example. but create_publisher also possibly generates exception RCLError so i think the current code would be better to be in principle.

I agree with you reasoning. A larger try block can catch other errors. This change looks good to me and can be merged.

fujitatomoya commented 3 years ago

CI:

fujitatomoya commented 3 years ago

@clalancette could you do me a favor? i don't have access permission to this repo.

clalancette commented 3 years ago

@clalancette could you do me a favor? i don't have access permission to this repo.

Sure, sounds good. I'll go ahead and merge this.