diff options
author | Martin Sivak <msivak@redhat.com> | 2008-04-08 16:20:31 +0200 |
---|---|---|
committer | Martin Sivak <msivak@redhat.com> | 2008-04-08 16:20:31 +0200 |
commit | 449b8ddf78368e4994f8bc48179a9f4f8be128d0 (patch) | |
tree | 6789f626e22209465eccededf0a7ccaeb934527a /pyfirstaidkit | |
parent | 8883825c01c2ae127f0be45c71a451e121821bad (diff) | |
download | firstaidkit-449b8ddf78368e4994f8bc48179a9f4f8be128d0.tar.gz firstaidkit-449b8ddf78368e4994f8bc48179a9f4f8be128d0.tar.xz firstaidkit-449b8ddf78368e4994f8bc48179a9f4f8be128d0.zip |
When using the iteration mode, catch all plugin exceptions so we can handle the None result in flow
Diffstat (limited to 'pyfirstaidkit')
-rw-r--r-- | pyfirstaidkit/plugins.py | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/pyfirstaidkit/plugins.py b/pyfirstaidkit/plugins.py index 0bdd7c3..825038c 100644 --- a/pyfirstaidkit/plugins.py +++ b/pyfirstaidkit/plugins.py @@ -237,11 +237,15 @@ class Plugin(object): Will return (self._state, self._result). The function that was executed and the return value. """ func = self.nextstate() + if func == self.final: raise StopIteration() else: - # Execute the function. - getattr(self, func)() + try: + # Execute the function. + self.call(func) + except: #fallback, when there is some error in plugin + pass return (self._state, self._result) # |