@@ -2531,7 +2531,7 @@ boost::shared_ptr<Convention> Conventions::get(const string& id) const {
25312531 }
25322532
25332533 if (unparsed.empty ()) {
2534- QL_FAIL (" Required convention '" << id << " ' not found." );
2534+ QL_FAIL (" Convention '" << id << " ' not found." );
25352535 }
25362536
25372537 boost::shared_ptr<Convention> convention;
@@ -2578,7 +2578,7 @@ boost::shared_ptr<Convention> Conventions::get(const string& id) const {
25782578 } else if (type == " BondYield" ) {
25792579 convention = boost::make_shared<BondYieldConvention>();
25802580 } else {
2581- QL_FAIL (" Required convention '" << id << " ' has unknown type '" + type + " ' not recognized." );
2581+ QL_FAIL (" Convention '" << id << " ' has unknown type '" + type + " ' not recognized." );
25822582 }
25832583
25842584 try {
@@ -2587,7 +2587,8 @@ boost::shared_ptr<Convention> Conventions::get(const string& id) const {
25872587 add (convention);
25882588 used_.insert (id);
25892589 } catch (exception& e) {
2590- QL_FAIL (" Required convention '" << id << " ' could not be built: " << e.what ());
2590+ WLOG (" Convention '" << id << " ' could not be built: " << e.what ());
2591+ QL_FAIL (" Convention '" << id << " ' could not be built: " << e.what ());
25912592 }
25922593
25932594 return convention;
@@ -2606,7 +2607,7 @@ boost::shared_ptr<Convention> Conventions::getFxConvention(const string& ccy1, c
26062607 }
26072608 }
26082609 }
2609- QL_FAIL (" Required FX convention for ccys '" << ccy1 << " ' and '" << ccy2 << " ' not found." );
2610+ QL_FAIL (" FX convention for ccys '" << ccy1 << " ' and '" << ccy2 << " ' not found." );
26102611}
26112612
26122613pair<bool , boost::shared_ptr<Convention>> Conventions::get (const string& id, const Convention::Type& type) const {
@@ -2616,7 +2617,7 @@ pair<bool, boost::shared_ptr<Convention>> Conventions::get(const string& id, con
26162617 used_.insert (id);
26172618 return std::make_pair (true , c);
26182619 }
2619- } catch (... ) {
2620+ } catch (const std::exception& e ) {
26202621 }
26212622 return make_pair (false , nullptr );
26222623}
@@ -2645,6 +2646,11 @@ std::set<boost::shared_ptr<Convention>> Conventions::get(const Convention::Type&
26452646}
26462647
26472648bool Conventions::has (const string& id) const {
2649+ try {
2650+ get (id);
2651+ } catch (const std::exception& e) {
2652+ return false ;
2653+ }
26482654 boost::shared_lock<boost::shared_mutex> lock (mutex_);
26492655 return data_.find (id) != data_.end () || unparsed_.find (id) != unparsed_.end () ||
26502656 data_.find (flip (id)) != data_.end () || unparsed_.find (flip (id)) != unparsed_.end ();
0 commit comments