Skip to content

[onert/python] Introduce NNFW exception bindings#15363

Merged
hseok-oh merged 1 commit intoSamsung:masterfrom
ragmani:onert/python/robust_error_management
May 20, 2025
Merged

[onert/python] Introduce NNFW exception bindings#15363
hseok-oh merged 1 commit intoSamsung:masterfrom
ragmani:onert/python/robust_error_management

Conversation

@ragmani
Copy link
Copy Markdown
Contributor

@ragmani ragmani commented May 13, 2025

This commit introduces NNFW exception bindings and comprehensive error handling.

  • Add nnfw_exception_bindings.h and nnfw_exceptions.h to define C++ exception types for NNFW errors
  • Bind all NnfwError subclasses into the Python module under a new exception submodule
  • Update nnfw_api_wrapper to replace exit(1) calls with throwing the corresponding NnfwError exceptions
  • Refactor getLayout, getType and getStringType to throw NnfwError on invalid inputs instead of exiting
  • In Python wrappers (BaseSession, session, and convenience functions), catch generic errors and rethrow them as OnertError with context
  • Ensure all C-API calls in Python raise OnertError on failure, improving robustness and traceback clarity

ONE-DCO-1.0-Signed-off-by: ragmani ragmani0216@gmail.com

This commit introduces NNFW exception bindings and comprehensive error handling.
- Add `nnfw_exception_bindings.h` and `nnfw_exceptions.h` to define C++ exception types for NNFW errors
- Bind all `NnfwError` subclasses into the Python module under a new exception submodule
- Update `nnfw_api_wrapper` to replace `exit(1)` calls with throwing the corresponding NnfwError exceptions
- Refactor `getLayout`, `getType` and `getStringType` to throw `NnfwError` on invalid inputs instead of exiting
- In Python wrappers (`BaseSession`, `session`, and convenience functions), catch generic errors and rethrow them as `OnertError` with context
- Ensure all C-API calls in Python raise `OnertError` on failure, improving robustness and traceback clarity

ONE-DCO-1.0-Signed-off-by: ragmani <ragmani0216@gmail.com>
@ragmani ragmani requested a review from a team May 13, 2025 09:59
@ragmani ragmani added the PR/ready for review It is ready to review. Please review it. label May 13, 2025
@ragmani
Copy link
Copy Markdown
Contributor Author

ragmani commented May 13, 2025

For #15172
Draft #15176

Copy link
Copy Markdown
Contributor

@hseok-oh hseok-oh left a comment

Choose a reason for hiding this comment

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

LGTM

@ragmani
Copy link
Copy Markdown
Contributor Author

ragmani commented May 20, 2025

@Samsung/one_onert PTAL

@hseok-oh hseok-oh merged commit 0058ea4 into Samsung:master May 20, 2025
10 checks passed
@ragmani ragmani deleted the onert/python/robust_error_management branch May 20, 2025 07:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

PR/ready for review It is ready to review. Please review it.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants