///////////////////////////////////////////////////////////////////////////////
/// \class RAT::DS::DataNotFound
///
/// \brief An exception that is thrown when a user atempts to retrieve
/// a value that does not have valid data.
///
/// \author Phil G Jones
///
/// REVISION HISTORY:\n
/// 2014-02-26 : P G Jones - New file \n
///
/// \details This is thrown whenever the user tries to retrieve a value
/// that is unsafe. For example a fit parameter that hasn't been fit.
/// It is also a base class for more relevant errors.
///
/// Aspects of the DS that do not use the DataNotFound exception instead
/// set the value of the variable to INVALID. This value is chosen to
/// be outside the acceptable domain for the vast majority of SNO+ data.
///
///////////////////////////////////////////////////////////////////////////////
#ifndef __RAT_DS_DataNotFound__
#define __RAT_DS_DataNotFound__
#include
#include
namespace RAT
{
namespace DS
{
/// Value used to designate data as invalid/not present,
const int INVALID = -99999;
class DataNotFound : public std::runtime_error
{
public:
/// Construct the error naming the variable that is problematic
///
/// @param[in] className of class the variable is a member of
/// @param[in] fieldName of the variable
/// @param[in] detail Optional explanation for the error
DataNotFound( const std::string className,
const std::string fieldName,
const std::string detail = "" ) : std::runtime_error("DS Variable cannot be accessed.\n" + detail),
fClassName(className), fFieldName(fieldName) { }
/// Destructor does nothing
virtual ~DataNotFound() throw() { }
std::string fClassName; ///< The name of the class that the variable belongs to
std::string fFieldName; ///< The name of the variable that cannot be accessed
};
} //::DS
} //::RAT
#endif