Merge "Add base exception class for this library"

This commit is contained in:
Jenkins 2015-06-25 21:10:17 +00:00 committed by Gerrit Code Review
commit a17e2ff682
3 changed files with 18 additions and 6 deletions

View File

@ -15,23 +15,27 @@
# under the License.
class InvalidState(Exception):
class AutomatonException(Exception):
"""Base class for *most* exceptions emitted from this library."""
class InvalidState(AutomatonException):
"""Raised when a invalid state transition is attempted while executing."""
class NotInitialized(Exception):
class NotInitialized(AutomatonException):
"""Error raised when an action is attempted on a not inited machine."""
class NotFound(Exception):
class NotFound(AutomatonException):
"""Raised when some entry in some object doesn't exist."""
class Duplicate(Exception):
class Duplicate(AutomatonException):
"""Raised when a duplicate entry is found."""
class FrozenMachine(Exception):
class FrozenMachine(AutomatonException):
"""Exception raised when a frozen machine is modified."""
def __init__(self):

View File

@ -35,3 +35,10 @@ Exceptions
.. automodule:: automaton.exceptions
:members:
Hierarchy
---------
.. inheritance-diagram::
automaton.exceptions
:parts: 1

View File

@ -23,7 +23,8 @@ sys.path.insert(0, os.path.abspath('../..'))
extensions = [
'sphinx.ext.autodoc',
'sphinx.ext.doctest',
'oslosphinx'
'sphinx.ext.inheritance_diagram',
'oslosphinx',
]
# autodoc generation is a bit aggressive and a nuisance when doing heavy