@@ -263,7 +263,11 @@ namespace
263263 }
264264 }
265265
266- irods::error retVal = self.effect_handler (self.rule_name , irods::unpack (rule_args_cpp));
266+ const auto err = self.effect_handler (self.rule_name , irods::unpack (rule_args_cpp));
267+
268+ const auto error_occurred = !err.ok () &&
269+ err.code () != CAT_NO_ROWS_FOUND &&
270+ err.code () != CAT_SUCCESS_BUT_WITH_NO_INFO;
267271
268272 bp::list ret_list{};
269273 while ( !rule_args_cpp.empty () ) {
@@ -275,24 +279,26 @@ namespace
275279 }
276280 else {
277281 ret_list.append (object_from_msParam (msParams.front ()));
278- clearMsParam (&msParams.front (), 1 );
282+
283+ if (!error_occurred) {
284+ clearMsParam (&msParams.front (), 1 );
285+ }
286+
279287 msParams.pop_front ();
280288 }
281289
282290 rule_args_cpp.pop_front ();
283291 }
284292
285- if (!retVal.ok ()) {
286- if ((retVal.code () != CAT_NO_ROWS_FOUND) && (retVal.code () != CAT_SUCCESS_BUT_WITH_NO_INFO)) {
287- std::string returnString = IRODS_ERROR_PREFIX + boost::lexical_cast<std::string>(retVal.code ()) + " ] " + retVal.result ().c_str ();
288- PyErr_SetString (PyExc_RuntimeError, returnString.c_str ());
289- bp::throw_error_already_set ();
290- }
293+ if (error_occurred) {
294+ std::string returnString = IRODS_ERROR_PREFIX + boost::lexical_cast<std::string>(err.code ()) + " ] " + err.result ().c_str ();
295+ PyErr_SetString (PyExc_RuntimeError, returnString.c_str ());
296+ bp::throw_error_already_set ();
291297 }
292298
293299 bp::dict ret;
294- ret[" code" ] = retVal .code ();
295- ret[" status" ] = retVal .status ();
300+ ret[" code" ] = err .code ();
301+ ret[" status" ] = err .status ();
296302 ret[" arguments" ] = ret_list;
297303 return ret;
298304 }
0 commit comments