CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
NoDataException Class Reference

#include <Exception/interface/NoDataException.h>

Detailed Description

Description: An exception that is thrown whenever data was not available in the Frame

Usage: NoDataException<> is thrown whenever an extract call fails because the type of data being extract was not available in the Frame.

If your program should continue even if the extract call fails, you should catch this exception.

try {
Item<DBEventHeader> eventHeader;
extract(iFrame.record(Stream::kBeginRun), eventHeader);
report(INFO, kFacilityString) << "run # " << eventHeader->runNumber()
<< "event # " << eventHeader->number()
<< std::endl;
report(WARNING, kFacilityString) << iException.what() << std::endl;
}

To make it easier to catch exceptions, all of the FAXXX types provide C preprocessor macros of the form

NO_XXX_DATA_EXCEPTION(type)

which are just shorthand ways of writing

E.g.

NO_ITEM_DATA_EXCEPTION(DBEventHeader)

is the same as writing

NOTE: NoDataException<> is only thrown when the data is unavailable. If the data should have been available but a problem occurred while obtaining the data, then a different type of exception will be thrown.

To catch ALL possible exceptions that can occur from the Data Access system you should catch exceptions of the type DAExceptionBase.