You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@buildstream.apache.org by gi...@apache.org on 2020/12/29 13:13:07 UTC

[buildstream] 07/07: optionpool: use context_for_bsterror

This is an automated email from the ASF dual-hosted git repository.

github-bot pushed a commit to branch aevri/provenance_scope
in repository https://gitbox.apache.org/repos/asf/buildstream.git

commit 6937f7f7c64385766443a41dbf9be2afaef55a14
Author: Angelos Evripiotis <je...@bloomberg.net>
AuthorDate: Fri Mar 15 17:45:32 2019 +0000

    optionpool: use context_for_bsterror
---
 buildstream/_options/optionpool.py | 7 ++-----
 1 file changed, 2 insertions(+), 5 deletions(-)

diff --git a/buildstream/_options/optionpool.py b/buildstream/_options/optionpool.py
index 3132af5..716be77 100644
--- a/buildstream/_options/optionpool.py
+++ b/buildstream/_options/optionpool.py
@@ -22,7 +22,7 @@ from collections.abc import Mapping
 import jinja2
 
 from .. import _yaml
-from .._exceptions import LoadError, LoadErrorReason
+from .._exceptions import LoadError, LoadErrorReason, context_for_bsterror
 from .optionbool import OptionBool
 from .optionenum import OptionEnum
 from .optionflags import OptionFlags
@@ -277,11 +277,8 @@ class OptionPool():
                                     "{}: Conditional statement has more than one key".format(p))
 
                 expression, value = tuples[0]
-                try:
+                with context_for_bsterror(p):
                     apply_fragment = self._evaluate(expression)
-                except LoadError as e:
-                    # Prepend the provenance of the error
-                    raise LoadError(e.reason, "{}: {}".format(p, e)) from e
 
                 if not hasattr(value, 'get'):
                     raise LoadError(LoadErrorReason.ILLEGAL_COMPOSITE,