Non-informative exception thrown if FHICL parameter isn't found in a Service constructor
I have a service that gets some parameters from a FHICL file. I do not supply a default to the pSet.get<> call. If the parameter is missing from the fcl, I do get an exception as expected, but the message contains no useful information telling my why an exception was thrown. For example,
---- Can't find key BEGIN world cet::exception going through module artg4Main/artg4Main run: 1 ---- Can't find key END
World is the name of my service. That message makes it extremely difficult to figure out what parameter is not in my fcl file. Can this be fixed to print an informative message?
#1 Updated by Christopher Green over 7 years ago
The key in question here is, "world."
There are a few things we could do here to improve this exception. First, we can correct the formatting of this particular exception to have a newline after the key name, and perhaps introduce the key name with words instead of leaving it unadorned. We can also change "Can't Find Key" to 'KeyNotFound' to make it obvious that we're not saying, "Can't find key BEGIN."
More generally, we could put the BEGIN and END keywords at the front of the delimiter lines rather than the end. This may disrupt log file parsing, however.