error messages: print cause tree as part of error
This commit is contained in:
parent
c1d6d93388
commit
f4402c1cde
@ -626,9 +626,9 @@ def _get_cause_tree(self, cause, conditions, condition_causes, literals, indent=
|
|||||||
)
|
)
|
||||||
]
|
]
|
||||||
|
|
||||||
def get_cause_tree(self, cause):
|
def get_cause_tree(self, result, best_model, cause):
|
||||||
conditions = dict(extract_args(self.model, "condition"))
|
conditions = dict(extract_args(best_model, "condition"))
|
||||||
condition_causes = list(extract_args(self.model, "condition_cause"))
|
condition_causes = list(extract_args(best_model, "condition_cause"))
|
||||||
return self._get_cause_tree(cause, conditions, condition_causes, [])
|
return self._get_cause_tree(cause, conditions, condition_causes, [])
|
||||||
|
|
||||||
def handle_error(self, msg, *args):
|
def handle_error(self, msg, *args):
|
||||||
@ -650,10 +650,6 @@ def handle_error(self, msg, *args):
|
|||||||
|
|
||||||
msg = msg.format(*msg_args)
|
msg = msg.format(*msg_args)
|
||||||
|
|
||||||
for cause in set(cause_args):
|
|
||||||
for c in self.get_cause_tree(cause):
|
|
||||||
msg += f"\n{c}"
|
|
||||||
|
|
||||||
# For variant formatting, we sometimes have to construct specs
|
# For variant formatting, we sometimes have to construct specs
|
||||||
# to format values properly. Find/replace all occurances of
|
# to format values properly. Find/replace all occurances of
|
||||||
# Spec(...) with the string representation of the spec mentioned
|
# Spec(...) with the string representation of the spec mentioned
|
||||||
@ -661,6 +657,10 @@ def handle_error(self, msg, *args):
|
|||||||
for spec_str in specs_to_construct:
|
for spec_str in specs_to_construct:
|
||||||
msg = msg.replace("Spec(%s)" % spec_str, str(spack.spec.Spec(spec_str)))
|
msg = msg.replace("Spec(%s)" % spec_str, str(spack.spec.Spec(spec_str)))
|
||||||
|
|
||||||
|
for cause in set(cause_args):
|
||||||
|
for c in self.get_cause_tree(cause):
|
||||||
|
msg += f"\n{c}"
|
||||||
|
|
||||||
return msg
|
return msg
|
||||||
|
|
||||||
def message(self, errors) -> str:
|
def message(self, errors) -> str:
|
||||||
|
Loading…
Reference in New Issue
Block a user