From e7524c4340523d06ba3d6d95cb1e284b0f4b415e Mon Sep 17 00:00:00 2001 From: Tom Pollard Date: Wed, 17 Jul 2019 15:48:06 +0100 Subject: _exceptions.py: Align LoadError() parameter ordering All of the errors which subclass from BstError have their first positional argument as message, LoadError should follow this ordering for consistency. --- src/buildstream/element.py | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) (limited to 'src/buildstream/element.py') diff --git a/src/buildstream/element.py b/src/buildstream/element.py index dffc33ba0..ee05153fe 100644 --- a/src/buildstream/element.py +++ b/src/buildstream/element.py @@ -524,7 +524,7 @@ class Element(Plugin): return self.__variables.subst(value) except LoadError as e: provenance = node.get_scalar(member_name).get_provenance() - raise LoadError(e.reason, '{}: {}'.format(provenance, e), detail=e.detail) from e + raise LoadError('{}: {}'.format(provenance, e), e.reason, detail=e.detail) from e def node_subst_list(self, node, member_name): """Fetch a list from a node member, substituting any variables in the list @@ -546,7 +546,7 @@ class Element(Plugin): ret.append(self.__variables.subst(value.as_str())) except LoadError as e: provenance = value.get_provenance() - raise LoadError(e.reason, '{}: {}'.format(provenance, e), detail=e.detail) from e + raise LoadError('{}: {}'.format(provenance, e), e.reason, detail=e.detail) from e return ret def compute_manifest(self, *, include=None, exclude=None, orphans=True): @@ -2658,9 +2658,8 @@ class Element(Plugin): provenance = node.get_provenance() if not provenance._is_synthetic: - raise LoadError(LoadErrorReason.PROTECTED_VARIABLE_REDEFINED, - "{}: invalid redefinition of protected variable '{}'" - .format(provenance, var)) + raise LoadError("{}: invalid redefinition of protected variable '{}'" + .format(provenance, var), LoadErrorReason.PROTECTED_VARIABLE_REDEFINED) return variables -- cgit v1.2.1