From 1062ed9720debfbf8796ef7cc2f04a1abbcce488 Mon Sep 17 00:00:00 2001 From: Nick Smith Date: Tue, 18 Jun 2024 16:21:32 -0400 Subject: [PATCH] Better error for missing input --- src/correctionlib/schemav2.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/correctionlib/schemav2.py b/src/correctionlib/schemav2.py index 9258820..ddc1266 100644 --- a/src/correctionlib/schemav2.py +++ b/src/correctionlib/schemav2.py @@ -357,6 +357,11 @@ def summarize( self, nodecount: Dict[str, int], inputstats: Dict[str, _SummaryInfo] ) -> None: nodecount["Category"] += 1 + if self.input not in inputstats: + raise RuntimeError( + f"The input variable {self.input} of a Category node is not defined " + "in the inputs of the Correction object" + ) inputstats[self.input].values |= {item.key for item in self.content} inputstats[self.input].default |= self.default is not None for item in self.content: