Pass kwargs to exception to get better format of error message

If we do not pass kwargs to exception, the parameter will be deemed
as message and will be displayed directly. This is to pass kwargs to
InvalidTaskType and InvalidTaskStatus, to get better format of error
message.

Change-Id: Ibdc6acc966509b2b4e0b15df49a1d22b55e746c7
This commit is contained in:
zhufl 2019-04-17 15:15:57 +08:00
parent f320401d38
commit a26019c2c6
1 changed files with 2 additions and 2 deletions

View File

@ -366,10 +366,10 @@ class Task(object):
task_input, result, message):
if task_type not in self._supported_task_type:
raise exception.InvalidTaskType(task_type)
raise exception.InvalidTaskType(type=task_type)
if status not in self._supported_task_status:
raise exception.InvalidTaskStatus(status)
raise exception.InvalidTaskStatus(status=status)
self.task_id = task_id
self._status = status