Skip to content

Commit

Permalink
[#126] Always return RULE_ENGINE_CONTINUE from exec_rule.
Browse files Browse the repository at this point in the history
  • Loading branch information
korydraughn committed Oct 20, 2023
1 parent 6d0d849 commit 0f02bae
Showing 1 changed file with 18 additions and 8 deletions.
26 changes: 18 additions & 8 deletions src/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -353,9 +353,16 @@ namespace irods::plugin::rule_engine::audit_amqp
std::map<std::string, std::size_t> arg_type_map;

ruleExecInfo_t* rei = nullptr;
irods::error err = _eff_hdlr("unsafe_ms_ctx", &rei);
if (!err.ok()) {
return err;
if (const auto err = _eff_hdlr("unsafe_ms_ctx", &rei); !err.ok()) {
// clang-format off
log_re::trace({
{"rule_engine_plugin", rule_engine_name},
{"log_message", "could not get rule execution context (REI)"},
{"rule_name", _rn},
{"error_result", err.result()}
});
// clang-format on
return CODE(RULE_ENGINE_CONTINUE);
}

nlohmann::json json_obj;
Expand Down Expand Up @@ -434,18 +441,21 @@ namespace irods::plugin::rule_engine::audit_amqp
}
catch (const irods::exception& e) {
log_exception(e, "Caught iRODS exception", {"rule_name", _rn});
return ERROR(e.code(), e.what());
}
catch (const nlohmann::json::exception& e) {
log_exception(e, "Caught nlohmann-json exception", {"rule_name", _rn});
return ERROR(SYS_LIBRARY_ERROR, e.what());
}
catch (const std::exception& e) {
log_exception(e, "Caught exception", {"rule_name", _rn});
return ERROR(SYS_INTERNAL_ERR, e.what());
}
catch (...) {
return ERROR(SYS_UNKNOWN_ERROR, "an unknown error occurred");
// clang-format off
log_re::error({
{"rule_engine_plugin", rule_engine_name},
{"log_message", "an unknown error occurred"},
{"rule_name", _rn}
});
// clang-format on
}

if (test_mode) {
Expand All @@ -455,7 +465,7 @@ namespace irods::plugin::rule_engine::audit_amqp
log_file_ofstream << msg_str << std::endl;
}

return err;
return CODE(RULE_ENGINE_CONTINUE);
}
} // namespace irods::plugin::rule_engine::audit_amqp

Expand Down

0 comments on commit 0f02bae

Please sign in to comment.