summaryrefslogtreecommitdiff
path: root/src/buildstream/_context.py
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/_context.py
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/_context.py')
-rw-r--r--src/buildstream/_context.py16
1 files changed, 6 insertions, 10 deletions
diff --git a/src/buildstream/_context.py b/src/buildstream/_context.py
index 3c20834b0..d3c6ef47c 100644
--- a/src/buildstream/_context.py
+++ b/src/buildstream/_context.py
@@ -214,12 +214,10 @@ class Context():
# Give obsoletion warnings
if 'builddir' in defaults:
- raise LoadError(LoadErrorReason.INVALID_DATA,
- "builddir is obsolete, use cachedir")
+ raise LoadError("builddir is obsolete, use cachedir", LoadErrorReason.INVALID_DATA)
if 'artifactdir' in defaults:
- raise LoadError(LoadErrorReason.INVALID_DATA,
- "artifactdir is obsolete")
+ raise LoadError("artifactdir is obsolete", LoadErrorReason.INVALID_DATA)
defaults.validate_keys([
'cachedir', 'sourcedir', 'builddir', 'logdir', 'scheduler', 'build',
@@ -268,10 +266,9 @@ class Context():
self.config_cache_quota = utils._parse_size(self.config_cache_quota_string,
self.casdir)
except utils.UtilError as e:
- raise LoadError(LoadErrorReason.INVALID_DATA,
- "{}\nPlease specify the value in bytes or as a % of full disk space.\n"
+ raise LoadError("{}\nPlease specify the value in bytes or as a % of full disk space.\n"
"\nValid values are, for example: 800M 10G 1T 50%\n"
- .format(str(e))) from e
+ .format(str(e)), LoadErrorReason.INVALID_DATA) from e
# Load artifact share configuration
self.artifact_cache_specs = ArtifactCache.specs_from_config_node(defaults)
@@ -526,7 +523,6 @@ def _node_get_option_str(node, key, allowed_options):
result = result_node.as_str()
if result not in allowed_options:
provenance = result_node.get_provenance()
- raise LoadError(LoadErrorReason.INVALID_DATA,
- "{}: {} should be one of: {}".format(
- provenance, key, ", ".join(allowed_options)))
+ raise LoadError("{}: {} should be one of: {}".format(provenance, key, ", ".join(allowed_options)),
+ LoadErrorReason.INVALID_DATA)
return result