Skip to content

MINIFICPP-2886 Improve rust api process errors - #2246

Open
martinzink wants to merge 1 commit into
minifi_rust_imprfrom
minifi_rust_impr_2
Open

MINIFICPP-2886 Improve rust api process errors#2246
martinzink wants to merge 1 commit into
minifi_rust_imprfrom
minifi_rust_impr_2

Conversation

@martinzink

@martinzink martinzink commented Aug 13, 2026

Copy link
Copy Markdown
Member

I've added a new layer that helps with routing, the process error now contains fatal and rotue errors.
One should use it based on the nature of the error. If its fatal the agent will handle the issue, if its routing error thats technically not an error in the eyes of the agent, we log it route to proper relationship then continue with data processing.

I've changed the errors a bit (schedule, trigger with string literal -> custom) it will already include the errors origin so no need to separate them


Thank you for submitting a contribution to Apache NiFi - MiNiFi C++.

In order to streamline the review of the contribution we ask you to ensure the following steps have been taken:

For all changes:

  • Is there a JIRA ticket associated with this PR? Is it referenced in the commit message?

  • Does your PR title start with MINIFICPP-XXXX where XXXX is the JIRA number you are trying to resolve? Pay particular attention to the hyphen "-" character.

  • Has your PR been rebased against the latest commit within the target branch (typically main)?

  • Is your initial contribution a single, squashed commit?

For code changes:

  • If adding new dependencies to the code, are these dependencies licensed in a way that is compatible for inclusion under ASF 2.0?
  • If applicable, have you updated the LICENSE file?
  • If applicable, have you updated the NOTICE file?

For documentation related changes:

  • Have you ensured that format looks appropriate for the output in which it is rendered?

Note:

Please ensure that once the PR is submitted, you check GitHub Actions CI results for build issues and submit an update to your PR as soon as possible.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Improves Rust processor error handling by separating routable failures from fatal trigger failures and updating processor wrappers and examples accordingly.

Changes:

  • Adds ProcessError, RouteError, and routing helpers.
  • Updates processor wrappers, attributes, and property definitions.
  • Migrates playground processors and tests to the revised API.

Reviewed changes

Copilot reviewed 36 out of 36 changed files in this pull request and generated 6 comments.

Show a summary per file
File Description
minifi_native/src/lib.rs Exports new error and attribute APIs.
c_ffi/c_ffi_processor_definition.rs Maps process errors to native statuses.
c_ffi/c_ffi_process_session.rs Preserves callback results during reads.
api/raw_processor.rs Changes trigger errors to ProcessError.
api/property.rs Makes property definitions cloneable.
utils/with_attributes.rs Adds attribute builder methods.
processor_wrappers/utils.rs Registers the attribute utility module.
flow_file_transform.rs Adds routable transform failures and builders.
flow_file_stream_transform.rs Adds routable streaming failures.
flow_file_source.rs Migrates source processing to ProcessError.
complex_processor.rs Migrates complex triggers to ProcessError.
api/errors.rs Defines the revised error model.
component_definition_traits.rs Replaces property constants with a method.
api/attribute.rs Adds borrowed output-attribute conversion.
minifi_native_sys/build.rs Adjusts bindgen C boolean handling.
zoo_processor.rs Migrates trigger and property APIs.
put_file/processor_definition.rs Dynamically combines platform properties.
put_file.rs Uses routable failure errors.
lorem_ipsum_cs_user/processor_definition.rs Migrates property definitions.
lorem_ipsum_cs_user.rs Migrates generated FlowFile construction.
log_attribute/processor_definition.rs Migrates property definitions.
log_attribute.rs Migrates trigger errors.
kamikaze_processor/tests.rs Updates error assertions.
kamikaze_processor/processor_definition.rs Migrates property definitions.
kamikaze_processor.rs Migrates schedule and trigger errors.
get_file/tests.rs Updates scheduling error coverage.
get_file/processor_definition.rs Migrates property definitions.
get_file.rs Migrates schedule and trigger errors.
generate_flow_file/processor_definition.rs Migrates property definitions.
generate_flow_file.rs Migrates trigger errors.
duplicate_text.rs Migrates streaming transform APIs.
count_actual_logging.rs Migrates trigger and property APIs.
asciify_german/tests.rs Updates malformed-input expectations.
asciify_german/processor_definition.rs Migrates property definitions.
asciify_german.rs Routes truncated input through ProcessError.
error-handling.feature Updates expected error log messages.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment on lines +544 to +545
if let Some(result) = ctx.result.take() {
return result;
pub fn attribute(&self, name: &str) -> Option<&str> {
self.attributes_to_add
.iter()
.find(|(k, _)| k == name)
pub fn get_attribute(&self, name: &str) -> Option<&str> {
self.attributes_to_add
.iter()
.find(|(k, _)| k == name)
assert_eq!(result.write_status(), IoState::Cancel);
assert_eq!(result.target_relationship_name(), FAILURE.name);
let result = asciify_german.transform(&context, &mut input_stream, &mut output_vec, &logger);
assert!(result.is_err());
GetFileRs::schedule(&context, &MockLogger::new()),
Err(MinifiError::ScheduleError(_))
));
assert!(GetFileRs::schedule(&context, &MockLogger::new()).is_err());
}
_ => write!(f, "{} (Unknown Status Code: {})", context, code),
},
MinifiError::Other(err) => write!(f, "Custom error: {}", err),
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants