Skip to content

Commit

Permalink
Merge pull request #11703 from wmtan/ReplaceCrypticAssert
Browse files Browse the repository at this point in the history
Replace cryptic assert with informative exception for missing Wrapper dictionary
  • Loading branch information
cmsbuild committed Oct 9, 2015
2 parents 7e778fc + e008ef8 commit 1ef860f
Showing 1 changed file with 20 additions and 1 deletion.
21 changes: 20 additions & 1 deletion FWCore/Utilities/src/TypeWithDict.cc
Original file line number Diff line number Diff line change
Expand Up @@ -354,7 +354,24 @@ namespace edm {
TypeWithDict::typeInfo() const {
if(*ti_ == typeid(dummyType) || isPointer() || isArray()) {
// No accurate type_info
assert(qualifiedName().c_str() == nullptr);
if(qualifiedName().c_str() != nullptr) {
std::string category("unknown");
if(isPointer()) {
category = "a pointer";
} else if(isArray()) {
category = "an array";
} else if(isEnum()) {
category = "an enum";
} else if(isClass()) {
throw Exception(errors::DictionaryNotFound)
<< "No Dictionary for class: '" << name() << "'" << std::endl;
}
throw Exception(errors::LogicError)
<< "Function TypeWithDict::typeInfo: Type\n"
<< qualifiedName()
<< "\ndoes not have valid type_info information in ROOT\n"
<< "because it is " << category << ".\n";
}
}
return *ti_;
}
Expand Down Expand Up @@ -490,6 +507,8 @@ namespace edm {
out << "::";
}
out << enum_->GetName();
} else if (*ti_ == typeid(dummyType) && isClass()) {
out << class_->GetName();
} else {
out << TypeID(*ti_).className();
}
Expand Down

0 comments on commit 1ef860f

Please sign in to comment.