diff options
| author | Joshua Harlow <harlowja@gmail.com> | 2015-03-15 18:39:24 -0700 |
|---|---|---|
| committer | Joshua Harlow <harlowja@gmail.com> | 2015-03-15 18:41:31 -0700 |
| commit | ebe3d6de186bb721a98dcbef3e5aead787a93fb4 (patch) | |
| tree | 77ff4d1023e9bc170168b8bea9304c0c130d2479 /taskflow/engines/worker_based | |
| parent | f890a096deb4e0b00b6382801bcf62015e0868a8 (diff) | |
| download | taskflow-ebe3d6de186bb721a98dcbef3e5aead787a93fb4.tar.gz | |
Just use the class name instead of TYPE constant
The TYPE constant is more of an internal protocol
detail and is not the best constant to use in exceptions
that tell the received data is invalid, instead just
prefer and use the class name instead which is more
relevant than the TYPE constant.
Change-Id: I60652a149eb1a3c3d8523544c355044bbd6fec94
Diffstat (limited to 'taskflow/engines/worker_based')
| -rw-r--r-- | taskflow/engines/worker_based/protocol.py | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/taskflow/engines/worker_based/protocol.py b/taskflow/engines/worker_based/protocol.py index 34dcd50..934f837 100644 --- a/taskflow/engines/worker_based/protocol.py +++ b/taskflow/engines/worker_based/protocol.py @@ -162,14 +162,15 @@ class Notify(Message): try: su.schema_validate(data, schema) except su.ValidationError as e: + cls_name = reflection.get_class_name(cls, fully_qualified=False) if response: raise excp.InvalidFormat("%s message response data not of the" " expected format: %s" - % (cls.TYPE, e.message), e) + % (cls_name, e.message), e) else: raise excp.InvalidFormat("%s message sender data not of the" " expected format: %s" - % (cls.TYPE, e.message), e) + % (cls_name, e.message), e) _WorkUnit = collections.namedtuple('_WorkUnit', ['task_cls', 'task_name', @@ -358,9 +359,10 @@ class Request(Message): try: su.schema_validate(data, cls.SCHEMA) except su.ValidationError as e: + cls_name = reflection.get_class_name(cls, fully_qualified=False) raise excp.InvalidFormat("%s message response data not of the" " expected format: %s" - % (cls.TYPE, e.message), e) + % (cls_name, e.message), e) else: # Validate all failure dictionaries that *may* be present... failures = [] @@ -501,9 +503,10 @@ class Response(Message): try: su.schema_validate(data, cls.SCHEMA) except su.ValidationError as e: + cls_name = reflection.get_class_name(cls, fully_qualified=False) raise excp.InvalidFormat("%s message response data not of the" " expected format: %s" - % (cls.TYPE, e.message), e) + % (cls_name, e.message), e) else: state = data['state'] if state == FAILURE and 'result' in data: |
