Project

General

Profile

Feature #2672

fhicl-cpp should wrap bad_any_cast to identify parameter and cast at issue.

Added by Christopher Green almost 8 years ago. Updated almost 5 years ago.

Status:
Closed
Priority:
Normal
Assignee:
Category:
Infrastructure
Target version:
Start date:
04/24/2012
Due date:
09/30/2013
% Done:

100%

Estimated time:
8.00 h
Spent time:
Scope:
Internal
Experiment:
SSI Package:
fhicl-cpp
Duration: 525

Description

Current error message during conversion says:

terminate called after throwing an instance of 'cet::coded_exception<fhicl::error, &(fhicl::detail::translate(fhicl::error))>'
  what():  ---- Type mismatch BEGIN
  boost::bad_any_cast: failed conversion using boost::any_cast
---- Type mismatch END

Exception from boost should be wrapped to include parameter name and type to which cast failed if possible.

History

#1 Updated by Christopher Green over 6 years ago

  • Due date set to 09/30/2013
  • Target version set to 1.09.00
  • Estimated time set to 8.00 h
  • Scope set to Internal
  • SSI Package fhicl-cpp added

#2 Updated by Christopher Green about 6 years ago

  • Target version changed from 1.09.00 to 521

#3 Updated by Kyle Knoepfel about 5 years ago

  • Target version changed from 521 to 1.14.00

#4 Updated by Kyle Knoepfel almost 5 years ago

  • Status changed from Accepted to Resolved
  • Assignee set to Kyle Knoepfel
  • % Done changed from 0 to 100

A boost::bad_any_cast exception is now wrapped so that for an error-prone incantation of parameterSet.get<A>( "a" ), the following is printed:

---- Type mismatch BEGIN

  Unsuccessful attempt to convert FHiCL parameter 'a' to type '(anonymous namespace)::A'.

  [Specific error:]
  boost::bad_any_cast: failed conversion using boost::any_cast

---- Type mismatch END

where the class A has been declared in an anonymous namespace, and whose stringified type is determined based on a call to

cet::demangle_symbol( typeid( instance_of_A ).name() ).

Implemented with commit fhicl-cpp:dbc4f12a2092b643fd2c6e9879eebb75a82dc481.

#5 Updated by Kyle Knoepfel almost 5 years ago

  • Status changed from Resolved to Closed


Also available in: Atom PDF