MINIFICPP-2886 Improve rust api process errors - #2246
Open
martinzink wants to merge 1 commit into
Open
Conversation
martinzink
force-pushed
the
minifi_rust_impr_2
branch
from
August 13, 2026 16:22
66ec2dd to
dcc5110
Compare
Contributor
There was a problem hiding this comment.
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), |
martinzink
force-pushed
the
minifi_rust_impr_2
branch
from
August 14, 2026 07:51
dcc5110 to
595c1bd
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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:
For documentation related changes:
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.