summaryrefslogtreecommitdiff
path: root/src/buildstream/_variables.pyx
diff options
context:
space:
mode:
authorTom Pollard <tom.pollard@codethink.co.uk>2019-07-17 15:48:06 +0100
committerbst-marge-bot <marge-bot@buildstream.build>2019-07-18 11:36:07 +0000
commite7524c4340523d06ba3d6d95cb1e284b0f4b415e (patch)
tree271d658e2fcdb7917dfca3c1270a4c3f31e80d76 /src/buildstream/_variables.pyx
parentd79747d7ee2596a73f4ec68bd40bd2ca04427a93 (diff)
downloadbuildstream-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/_variables.pyx')
-rw-r--r--src/buildstream/_variables.pyx12
1 files changed, 6 insertions, 6 deletions
diff --git a/src/buildstream/_variables.pyx b/src/buildstream/_variables.pyx
index 8f91c9ced..f8662ac61 100644
--- a/src/buildstream/_variables.pyx
+++ b/src/buildstream/_variables.pyx
@@ -106,7 +106,7 @@ cdef class Variables:
", ".join(unmatched)
)
- raise LoadError(LoadErrorReason.UNRESOLVED_VARIABLE, message)
+ raise LoadError(message, LoadErrorReason.UNRESOLVED_VARIABLE)
# Otherwise, re-raise the KeyError since it clearly came from some
# other unknowable cause.
raise
@@ -142,8 +142,8 @@ cdef class Variables:
provenance = self.original.get_scalar(key).get_provenance()
summary.append(line.format(unmatched=var, variable=key, provenance=provenance))
if summary:
- raise LoadError(LoadErrorReason.UNRESOLVED_VARIABLE,
- "Failed to resolve one or more variable:\n{}\n".format("\n".join(summary)))
+ raise LoadError("Failed to resolve one or more variable:\n{}\n".format("\n".join(summary)),
+ LoadErrorReason.UNRESOLVED_VARIABLE)
def _check_for_cycles(self):
# And now the cycle checks
@@ -152,10 +152,10 @@ cdef class Variables:
if var in cleared:
continue
if var in visited:
- raise LoadError(LoadErrorReason.RECURSIVE_VARIABLE,
- "{}: ".format(self.original.get_scalar(var).get_provenance()) +
+ raise LoadError("{}: ".format(self.original.get_scalar(var).get_provenance()) +
("Variable '{}' expands to contain a reference to itself. " +
- "Perhaps '{}' contains '%{{{}}}").format(var, visited[-1], var))
+ "Perhaps '{}' contains '%{{{}}}").format(var, visited[-1], var),
+ LoadErrorReason.RECURSIVE_VARIABLE)
visited.append(var)
cycle_check(self._expstr_map[var], visited, cleared)
visited.pop()