diff options
Diffstat (limited to 'lib/spack/spack/spec.py')
-rw-r--r-- | lib/spack/spack/spec.py | 18 |
1 files changed, 13 insertions, 5 deletions
diff --git a/lib/spack/spack/spec.py b/lib/spack/spack/spec.py index 580064fca4..aa9cd6a709 100644 --- a/lib/spack/spack/spec.py +++ b/lib/spack/spack/spec.py @@ -2183,7 +2183,10 @@ class Spec(object): data = yaml.load(stream) return Spec.from_dict(data) except yaml.error.MarkedYAMLError as e: - raise syaml.SpackYAMLError("error parsing YAML spec:", str(e)) + raise six.raise_from( + syaml.SpackYAMLError("error parsing YAML spec:", str(e)), + e, + ) @staticmethod def from_json(stream): @@ -2196,8 +2199,10 @@ class Spec(object): data = sjson.load(stream) return Spec.from_dict(data) except Exception as e: - tty.debug(e) - raise sjson.SpackJSONError("error parsing JSON spec:", str(e)) + raise six.raise_from( + sjson.SpackJSONError("error parsing JSON spec:", str(e)), + e, + ) @staticmethod def from_detection(spec_str, extra_attributes=None): @@ -2734,7 +2739,10 @@ class Spec(object): # with inconsistent constraints. Users cannot produce # inconsistent specs like this on the command line: the # parser doesn't allow it. Spack must be broken! - raise InconsistentSpecError("Invalid Spec DAG: %s" % e.message) + raise six.raise_from( + InconsistentSpecError("Invalid Spec DAG: %s" % e.message), + e, + ) def index(self, deptype='all'): """Return DependencyMap that points to all the dependencies in this @@ -4767,7 +4775,7 @@ class SpecParser(spack.parse.Parser): self.unexpected_token() except spack.parse.ParseError as e: - raise SpecParseError(e) + raise six.raise_from(SpecParseError(e), e) # Generate lookups for git-commit-based versions for spec in specs: |