summary |
shortlog |
log |
commit | commitdiff |
tree
raw |
patch |
inline | side by side (from parent 1:
5933c0f)
Returning None from this function when there's no plugin is Pythonically
weird:
plugin = bt2.create_plugin_from_name()
print(plugin.name)
The execution should not reach print() here when the plugin is not
found.
Raise the new bt2.NoSuchPluginError exception instead.
Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
+class NoSuchPluginError(Error):
+ pass
+
+
class UnsupportedFeature(Exception):
pass
class UnsupportedFeature(Exception):
pass
import bt2.native_bt as _native_bt
import atexit
import bt2.native_bt as _native_bt
import atexit
plugin_ptr = native_bt.plugin_create_from_name(name)
if plugin_ptr is None:
plugin_ptr = native_bt.plugin_create_from_name(name)
if plugin_ptr is None:
+ raise bt2.NoSuchPluginError(name)
return _Plugin._create_from_ptr(plugin_ptr)
return _Plugin._create_from_ptr(plugin_ptr)