Skip to content
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions osquery/registry/registry_interface.h
Original file line number Diff line number Diff line change
Expand Up @@ -266,8 +266,8 @@ class RegistryType : public RegistryInterface {
const PluginRef& plugin_item,
bool internal = false) override {
if (nullptr == std::dynamic_pointer_cast<PluginType>(plugin_item)) {
throw std::runtime_error("Cannot add foreign plugin type: " +
plugin_name);
return Status::failure("Cannot add foreign plugin type: " +
plugin_name);
}
return addPlugin(plugin_name, plugin_item, internal);
}
Comment on lines 266 to 273

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🦩 🔴 RegistryType::add() throws std::runtime_error instead of returning Status::failure()

In RegistryType<PluginType>::add() (registry_interface.h), replaced throw std::runtime_error("Cannot add foreign plugin type: " + plugin_name); with return Status::failure("Cannot add foreign plugin type: " + plugin_name);, matching the surrounding Status-based error handling and the suggested fix exactly. No other lines were changed.

🤖 Prompt for AI agents
In osquery/registry/registry_interface.h around line 253, review and complete this code-review fix: RegistryType::add() throws std::runtime_error instead of returning Status::failure().
What the draft fix changed: In `RegistryType<PluginType>::add()` (registry_interface.h), replaced `throw std::runtime_error("Cannot add foreign plugin type: " + plugin_name);` with `return Status::failure("Cannot add foreign plugin type: " + plugin_name);`, matching the surrounding `Status`-based error handling and the suggested fix exactly. No other lines were changed.
Verify the change is correct and complete; do not refactor unrelated code.

fix confidence: 🟢 90 high — react 👍/👎 to teach the reviewer

Expand Down Expand Up @@ -349,3 +349,4 @@ class AutoRegisterInterface {

void registryAndPluginInit();
} // namespace osquery