summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRaoul Hidalgo Charman <raoul.hidalgocharman@codethink.co.uk>2019-06-13 16:35:48 +0100
committerRaoul Hidalgo Charman <raoul.hidalgocharman@codethink.co.uk>2019-06-13 17:13:30 +0100
commit3395d91eb42302bf64e2c124f0990f7eb44d3962 (patch)
tree06df14883509c4cdb31a2c266463b5a7da02fa10
parent9be35e6cef297cef1da43f4cc2dc4ca78a847725 (diff)
downloadbuildstream-raoul/unique-error-domains.tar.gz
_exceptions.py: Make ErrorDomain uniqueraoul/unique-error-domains
For some reason PROG_NOT_FOUND and APP were both under 12 which could be confusing. Changed PROG_NOT_FOUND to 16 and added a unique decorator to prevent this from happening again. Updated shellbuildtrees test to check correct error domain.
-rw-r--r--src/buildstream/_exceptions.py5
-rw-r--r--tests/integration/shellbuildtrees.py2
2 files changed, 4 insertions, 3 deletions
diff --git a/src/buildstream/_exceptions.py b/src/buildstream/_exceptions.py
index f2d34bcba..819f9538c 100644
--- a/src/buildstream/_exceptions.py
+++ b/src/buildstream/_exceptions.py
@@ -18,7 +18,7 @@
# Tristan Van Berkom <tristan.vanberkom@codethink.co.uk>
# Tiago Gomes <tiago.gomes@codethink.co.uk>
-from enum import Enum
+from enum import Enum, unique
import os
# Disable pylint warnings for whole file here:
@@ -79,6 +79,7 @@ def set_last_task_error(domain, reason):
_last_task_error_reason = reason
+@unique
class ErrorDomain(Enum):
PLUGIN = 1
LOAD = 2
@@ -89,13 +90,13 @@ class ErrorDomain(Enum):
PIPELINE = 7
OSTREE = 8
UTIL = 9
- PROG_NOT_FOUND = 12
SOURCE = 10
ELEMENT = 11
APP = 12
STREAM = 13
VIRTUAL_FS = 14
CAS = 15
+ PROG_NOT_FOUND = 16
# BstError is an internal base exception class for BuildSream
diff --git a/tests/integration/shellbuildtrees.py b/tests/integration/shellbuildtrees.py
index 78dad8747..e53003757 100644
--- a/tests/integration/shellbuildtrees.py
+++ b/tests/integration/shellbuildtrees.py
@@ -286,7 +286,7 @@ def test_buildtree_options(cli, tmpdir, datafiles):
res = cli.run(project=project, args=[
'shell', '--build', element_name, '--use-buildtree', 'always', '--', 'cat', 'test'
])
- res.assert_main_error(ErrorDomain.PROG_NOT_FOUND, None)
+ res.assert_main_error(ErrorDomain.APP, None)
assert 'Buildtree is not cached locally or in available remotes' in res.stderr
assert 'Hi' not in res.output
assert 'Attempting to fetch missing artifact buildtree' not in res.stderr