Commit bec4e375 authored by payno's avatar payno

[workflow] replace some assert by error raises

parent 5f2a8913
......@@ -25,7 +25,8 @@ def get_handler(obj, data_name):
def _createCallback(name):
sname = name.rsplit('.')
assert (len(sname) > 1)
if not (len(sname) > 1):
raise ValueError('Invalid name')
class_name = sname[-1]
del sname[-1]
module_name = '.'.join(sname)
......@@ -42,6 +43,7 @@ def _createCallback(name):
def exec_process(callback_info, input_, properties):
logger.debug('processing', str(callback_info), 'with input', input_, 'and',
properties, 'as properties')
if type(input_) is tuple:
data_name, data = input_
else:
......@@ -73,7 +75,8 @@ def exec_process(callback_info, input_, properties):
# pick the default process function is no handler and object not callable
if handler is not None:
assert hasattr(callback, handler)
if not hasattr(callback, handler):
raise ValueError('handler function', handler, 'does not exist for', callback)
out = getattr(callback, handler)(data)
else:
out = callback(data)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment