Skip to content

Commit 22d9b55

Browse files
committed
fix: address review feedback on warning infrastructure
- Separate ParameterErrorCode::NONE from error cases in classify_error_code with comment explaining it is unreachable - Add comment to ros2_medkit_msgs explaining why ROS2MedkitWarnings is not included (rosidl-generated code) - Simplify format specifier in fault_manager_node: use %ld directly instead of PRId64 + static_cast (declare_parameter<int> returns long)
1 parent d2e55eb commit 22d9b55

3 files changed

Lines changed: 8 additions & 3 deletions

File tree

src/ros2_medkit_fault_manager/src/fault_manager_node.cpp

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@
1717
#include <yaml-cpp/yaml.h>
1818

1919
#include <cctype>
20-
#include <cinttypes>
2120
#include <filesystem>
2221
#include <fstream>
2322
#include <nlohmann/json.hpp>
@@ -111,8 +110,7 @@ FaultManagerNode::FaultManagerNode(const rclcpp::NodeOptions & options) : Node("
111110
}
112111
auto max_snapshots = declare_parameter<int>("snapshots.max_per_fault", 10);
113112
if (max_snapshots < 0) {
114-
RCLCPP_WARN(get_logger(), "snapshots.max_per_fault should be >= 0, got %" PRId64 ". Disabling limit.",
115-
static_cast<int64_t>(max_snapshots));
113+
RCLCPP_WARN(get_logger(), "snapshots.max_per_fault should be >= 0, got %ld. Disabling limit.", max_snapshots);
116114
max_snapshots = 0;
117115
}
118116

src/ros2_medkit_gateway/src/http/handlers/config_handlers.cpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -134,6 +134,11 @@ static ErrorClassification classify_error_code(ParameterErrorCode error_code) {
134134
result.error_code = ERR_INVALID_PARAMETER;
135135
break;
136136
case ParameterErrorCode::NONE:
137+
// NONE means "no error" - caller (classify_parameter_error) pre-filters
138+
// this case, so reaching here indicates a programming error.
139+
result.status_code = 500;
140+
result.error_code = ERR_INTERNAL_ERROR;
141+
break;
137142
case ParameterErrorCode::SHUT_DOWN:
138143
case ParameterErrorCode::INTERNAL_ERROR:
139144
default:

src/ros2_medkit_msgs/CMakeLists.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,8 @@
1515
cmake_minimum_required(VERSION 3.8)
1616
project(ros2_medkit_msgs)
1717

18+
# Note: ROS2MedkitWarnings is intentionally NOT included here.
19+
# rosidl-generated code triggers strict warnings we cannot fix.
1820
find_package(ament_cmake REQUIRED)
1921
find_package(rosidl_default_generators REQUIRED)
2022
find_package(builtin_interfaces REQUIRED)

0 commit comments

Comments
 (0)