Project

General

Profile

Feature #2445

Updated by Christopher Green almost 7 years ago

I am writing a service that contains the following fragment called from its c'tor<pre> c'tor

baseSeed_ = pSet.get<unsigned>("baseSeed");</pre> pSet.get<unsigned>("baseSeed");

where pSet is an @fhicl::ParameterSet const&@ fhicl::ParameterSet const& and where @baseSeed_@ baseSeed_ is an @unsigned@. unsigned.

If the parameter is absent in the .fcl file, I get the following message:<pre>%MSG-s message:

%MSG-s
ArtException: mu2e 02-Feb-2012 11:33:10 CST JobSetup
cet::exception caught in art
---- OtherArt BEGIN
ServiceCreation
---- Can't find key BEGIN
baseSeed
---- Can't find key END
cet::exception caught during construction of service type mu2e::Seeds:
---- OtherArt ENDArt has completed and will exit with status
%MSG</pre> %MSG

The two important pieces of information are lost in the framing information. Is there any hope of improving this?

I can always improve the error message by:<pre> by:
if ( !pSet.get_if_present("baseSeed",baseSeed_) ){
throw cet::exception("SEEDS")
<< "SeedService: was unable to find the parameter baseSeed in the input parameter set.\n";
}</pre> }

but the code is much easier to read if I don't feel the need to do this.

Back