Plugin API: *_plugin_get_last_exception: Return pointer to last exception #2052
+206
−12
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.
Closes: #2047
To prevent function names from being mangled in the plugin API, these functions are linked as C language functions (extern "C"). We do not throw exceptions from these functions. Specifically, the
libdnf_plugin_new_instance
anddnf5_plugin_new_instance
functions return a null pointer on failure and discard the exception. Thus, the caller (libdnf library or dnf5 application) does not know the reason for the failure.Changes:
This modification extends the libdnf and dnf5 plugin APIs with new
libdnf_plugin_get_last_exception
anddnf5_plugin_get_last_exception
functions. The plugin can save the exception instead of discarding it. The new functions allow access to the saved exception.All plugins have been modified to implement the new API functionality.
Documentation string were improved.
Note:
The original functions are unchanged. Plugins that do not implement the new functions can still be used. API and ABI remain compatible.