1
0
mirror of https://github.com/ARM-software/workload-automation.git synced 2024-10-06 02:41:11 +01:00

utils/serializer: fix error reporting for YAML

When attempting to access the message of a exception check not only that
e.args is populated, but also that e.args[0] actually contains
something, before defaulting to str(e).
This commit is contained in:
Sergei Trofimov 2019-05-13 16:13:53 +01:00 committed by Marc Bonnici
parent ec3d928b3b
commit e9f5577237

View File

@ -259,7 +259,8 @@ class yaml(object):
lineno = None
if hasattr(e, 'problem_mark'):
lineno = e.problem_mark.line # pylint: disable=no-member
raise SerializerSyntaxError(e.args[0] if e.args else str(e), lineno)
message = e.args[0] if (e.args and e.args[0]) else str(e)
raise SerializerSyntaxError(message, lineno)
loads = load