Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Using API assertions and converting them in SWIG #373

Merged
merged 10 commits into from
Mar 24, 2023

Conversation

jan-kolarik
Copy link
Member

Try to use API assertions wherever it makes sense and for bindings translate those to standard SWIG runtime exceptions. All usages should be supported by unit tests.

Note: like I've written in some previous SWIG-related PR, it would be nice to have a better solution translating those exceptions on the level where they are actually thrown. Now all methods in generated bindings have their own try-catch blocks.

Closes #345.

…rrors

For now we don't want to core dump any situation regarding API assertions or runtime errors, therefore converting them to standard SWIG runtime errors.

Note: it seems currently there is no easy way how to define this exception handling globally with overriding/adjusting additional handlers in specific files.
Tests for throwing goal resolving problems and move them to a separate test file.
Switch to using API assertions for unsupported arguments in order to don't kill the process when using Python bindings.
Switch to API assertion exceptions when using the `libdnf::Option` methods incorrectly.
Switch to using API assertion when checking any existing `GlobalLogger` instance in ctor.
Switch to using API assertions on API method `load_extra_system_repo`.
@jan-kolarik jan-kolarik force-pushed the jkolarik/swig-api-exceptions branch from 1b73363 to d0b7bc7 Compare March 17, 2023 14:36
@m-blaha m-blaha self-assigned this Mar 24, 2023
@m-blaha
Copy link
Member

m-blaha commented Mar 24, 2023

Thanks a lot, LGTM.

@m-blaha m-blaha merged commit d41839f into main Mar 24, 2023
@m-blaha m-blaha deleted the jkolarik/swig-api-exceptions branch March 24, 2023 09:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

python bindings: core dumped when resolving various improper input via the add_install method
2 participants