[Checkins] SVN: hurry.workflow/trunk/ Make exceptions display more informative messages too.
Martijn Faassen
cvs-admin at zope.org
Thu Jan 17 15:52:47 UTC 2013
Log message for revision 129043:
Make exceptions display more informative messages too.
Changed:
U hurry.workflow/trunk/CHANGES.txt
U hurry.workflow/trunk/src/hurry/workflow/interfaces.py
U hurry.workflow/trunk/src/hurry/workflow/workflow.txt
-=-
Modified: hurry.workflow/trunk/CHANGES.txt
===================================================================
--- hurry.workflow/trunk/CHANGES.txt 2013-01-17 15:31:31 UTC (rev 129042)
+++ hurry.workflow/trunk/CHANGES.txt 2013-01-17 15:52:46 UTC (rev 129043)
@@ -2,12 +2,11 @@
hurry.workflow changes
======================
-0.14 (unreleased)
-=================
+0.13.1 (unreleased)
+===================
-- Nothing changed yet.
+* Make the exceptions also display more informative messages.
-
0.13 (2013-01-17)
=================
Modified: hurry.workflow/trunk/src/hurry/workflow/interfaces.py
===================================================================
--- hurry.workflow/trunk/src/hurry/workflow/interfaces.py 2013-01-17 15:31:31 UTC (rev 129042)
+++ hurry.workflow/trunk/src/hurry/workflow/interfaces.py 2013-01-17 15:52:46 UTC (rev 129043)
@@ -9,16 +9,25 @@
def __init__(self, source):
self.source = source
+ def __str__(self):
+ return 'source: "%s"' % self.source
+
class NoTransitionAvailableError(InvalidTransitionError):
def __init__(self, source, destination):
super(NoTransitionAvailableError, self).__init__(source)
self.destination = destination
-
+
+ def __str__(self):
+ return 'source: "%s" destination: "%s"' % (self.source, self.destination)
+
class AmbiguousTransitionError(InvalidTransitionError):
def __init__(self, source, destination):
super(AmbiguousTransitionError, self).__init__(source)
self.destination = destination
+ def __str__(self):
+ return 'source: "%s" destination: "%s"' % (self.source, self.destination)
+
class ConditionFailedError(Exception):
pass
Modified: hurry.workflow/trunk/src/hurry/workflow/workflow.txt
===================================================================
--- hurry.workflow/trunk/src/hurry/workflow/workflow.txt 2013-01-17 15:31:31 UTC (rev 129042)
+++ hurry.workflow/trunk/src/hurry/workflow/workflow.txt 2013-01-17 15:52:46 UTC (rev 129043)
@@ -106,6 +106,11 @@
If we try to get a transition that doesn't exist, we get an error::
+ >>> wf.getTransition('b', 'a_to_b')
+ Traceback (most recent call last):
+ ...
+ InvalidTransitionError: source: "b"
+
>>> from hurry.workflow.interfaces import InvalidTransitionError
>>> try:
... wf.getTransition('b', 'a_to_b')
@@ -183,7 +188,7 @@
>>> info.fireTransitionToward('c')
Traceback (most recent call last):
...
- NoTransitionAvailableError
+ NoTransitionAvailableError: source: "a" destination: "c"
This error has some information available of what transition was attempted::
@@ -820,7 +825,7 @@
>>> info.fireTransitionToward(PUBLISHED)
Traceback (most recent call last):
...
- NoTransitionAvailableError
+ NoTransitionAvailableError: source: "unpublished" destination: "published"
In this case, the transition even't even available because the user
doesn't have the right permission.
@@ -953,6 +958,11 @@
``fireTransitionToward`` is ambiguous as two transitions are possible::
+ >>> info.fireTransitionToward('b')
+ Traceback (most recent call last):
+ ...
+ AmbiguousTransitionError: source: "a" destination: "b"
+
>>> from hurry.workflow.interfaces import AmbiguousTransitionError
>>> try:
... info.fireTransitionToward('b')
More information about the checkins
mailing list