diff options
author | Tom Pollard <tom.pollard@codethink.co.uk> | 2019-07-17 15:48:06 +0100 |
---|---|---|
committer | bst-marge-bot <marge-bot@buildstream.build> | 2019-07-18 11:36:07 +0000 |
commit | e7524c4340523d06ba3d6d95cb1e284b0f4b415e (patch) | |
tree | 271d658e2fcdb7917dfca3c1270a4c3f31e80d76 /src/buildstream/element.py | |
parent | d79747d7ee2596a73f4ec68bd40bd2ca04427a93 (diff) | |
download | buildstream-e7524c4340523d06ba3d6d95cb1e284b0f4b415e.tar.gz |
_exceptions.py: Align LoadError() parameter orderingtpollard/loaderror
All of the errors which subclass from BstError have their first
positional argument as message, LoadError should follow this
ordering for consistency.
Diffstat (limited to 'src/buildstream/element.py')
-rw-r--r-- | src/buildstream/element.py | 9 |
1 files changed, 4 insertions, 5 deletions
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 |