From 7fed0375c4c22c9ad355a31926d86f689cba898c Mon Sep 17 00:00:00 2001 From: "Richard W.M. Jones" Date: Thu, 27 Feb 2020 08:20:31 +0000 Subject: [PATCH] run: Improve error message if a predicate script fails. In particular always print the fully resolved parameters of the predicate. --- src/run.ml | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/run.ml b/src/run.ml index 5aad484..3a04256 100644 --- a/src/run.ml +++ b/src/run.ml @@ -122,9 +122,12 @@ and needs_rebuild ?(final_check = false) env loc deps extra_deps pattern = let r = Eval.run_code env loc code in if r = 99 (* means "needs rebuild" *) then true else if r = 0 (* means "doesn't need rebuild" *) then false - else - failwithf "%a: predicate ‘%s’ failed with exit code %d" - Ast.string_loc loc pred r + else ( + let targs = List.map (Ast.string_expr ()) targs in + let targs = String.concat ", " targs in + failwithf "%a: predicate ‘%s (%s)’ failed with exit code %d" + Ast.string_loc loc pred targs r + ) and exists_runner env loc p debug_pred = Cmdline.debug "%a: running implicit existence rule for predicate %s" -- 1.8.3.1