This class is the based class for all the exceptions in the FESA framework. It contains an error code in order to retrieve the message linked to the error. This error code has to be in the messages.cfg file The class also admits parameters to be replaced in the message in the format $1,$2 ... More...
#include <FesaException.h>
Public Member Functions | |
FesaException () | |
constructor used in the derive classes since we can't use the one with variable parameters | |
FesaException (const std::string &file, int32_t lineNumber, const char *errorMessage,...) | |
Constructor. | |
FesaException (const std::string &file, int32_t lineNumber, const std::string &message) | |
Constructor which can be used without Exception-File. | |
virtual | ~FesaException () throw () |
const char * | what () const throw () |
const std::string & | getMessage () const |
This method returns the message linked to the error code of the exception. | |
const std::string & | getErrorCode () |
This method returns the the error code of the exception. | |
const std::string & | getFileName () |
get the file in which the exception occurred | |
int32_t | getLineNumber () |
line number in which the exception occurred | |
long | getErrorCodeAsLong () |
This method returns the the error code of the exception as long. | |
void | preloadMessages () |
This method preload all the messages to avoid to do it runtime. | |
Protected Member Functions | |
void | buildMessage (va_list vl) |
method, which initializes the parameter-list of this exception | |
virtual void | loadMessagesFile (const std::string &file) |
This method loads all the messages from the file and puts them into a key map <errorCode,message>. | |
Protected Attributes | |
std::string | message_ |
message to return | |
std::string | errorCode_ |
error code | |
std::string | file_ |
file, where the error comes from | |
int32_t | lineNumber_ |
line number, where the error was thrown | |
Static Protected Attributes | |
static std::map< std::string, std::string > | messages_ |
<ErrorCode, Message> This attribute contains the relation between the exception code and the message | |
static bool | messagesLoaded_ = false |
This class is the based class for all the exceptions in the FESA framework. It contains an error code in order to retrieve the message linked to the error. This error code has to be in the messages.cfg file The class also admits parameters to be replaced in the message in the format $1,$2 ...
Definition at line 28 of file FesaException.h.
fesa::FesaException::FesaException | ( | ) |
constructor used in the derive classes since we can't use the one with variable parameters
Definition at line 37 of file FesaException.cpp.
Referenced by loadMessagesFile().
fesa::FesaException::FesaException | ( | const std::string & | file, | |
int32_t | lineNumber, | |||
const char * | errorMessage, | |||
... | ||||
) |
Constructor.
errorCode | ||
file | in which the exception occurred | |
line | in which the exception occurred | |
errorMessage | to be shown or code associated with it | |
list | of variables separated by comma which contain the parameters for the exception |
Definition at line 51 of file FesaException.cpp.
References buildMessage().
fesa::FesaException::FesaException | ( | const std::string & | file, | |
int32_t | lineNumber, | |||
const std::string & | message | |||
) |
Constructor which can be used without Exception-File.
errorCode | ||
file | in which the exception occurred | |
line | in which the exception occurred | |
message | The final error-message as std::string |
Definition at line 44 of file FesaException.cpp.
fesa::FesaException::~FesaException | ( | ) | throw () [virtual] |
Definition at line 108 of file FesaException.cpp.
void fesa::FesaException::buildMessage | ( | va_list | vl | ) | [protected] |
method, which initializes the parameter-list of this exception
Definition at line 62 of file FesaException.cpp.
References errorCode_, file_, lineNumber_, message_, messages_, and preloadMessages().
Referenced by fesa::FesaBadConfigException::FesaBadConfigException(), fesa::FesaBadParameterException::FesaBadParameterException(), FesaException(), fesa::FesaFileException::FesaFileException(), fesa::FesaInvalidResourceException::FesaInvalidResourceException(), fesa::FesaIOException::FesaIOException(), and fesa::FesaTypeMismatchException::FesaTypeMismatchException().
const std::string & fesa::FesaException::getErrorCode | ( | ) | [inline] |
This method returns the the error code of the exception.
Definition at line 140 of file FesaException.h.
References errorCode_.
Referenced by fesa::SynchronizationFactory::createCycleDescriptor(), and fesa::AbstractServerEquipment::getDeviceClassFromDeviceName().
long fesa::FesaException::getErrorCodeAsLong | ( | ) |
This method returns the the error code of the exception as long.
Definition at line 122 of file FesaException.cpp.
References errorCode_.
Referenced by fesa::AbstractSubscriptionFilter::cycleFirstUpdate(), fesa::SubscriptionFilter::doUpdate(), fesa::FesaDeviceServer::get(), fesa::FesaDeviceServer::monitorOff(), fesa::FesaDeviceServer::monitorOn(), and fesa::FesaDeviceServer::set().
const std::string & fesa::FesaException::getFileName | ( | ) | [inline] |
get the file in which the exception occurred
Definition at line 145 of file FesaException.h.
References file_.
Referenced by fesa::StoreManager::restore(), fesa::AbstractField::restore(), fesa::ShmFactory< GlobalDeviceType, DomainStoreType, DevInstType >::setUpMemory(), and fesa::AbstractField::store().
int32_t fesa::FesaException::getLineNumber | ( | ) | [inline] |
line number in which the exception occurred
Definition at line 150 of file FesaException.h.
References lineNumber_.
Referenced by fesa::StoreManager::restore(), fesa::AbstractField::restore(), fesa::ShmFactory< GlobalDeviceType, DomainStoreType, DevInstType >::setUpMemory(), and fesa::AbstractField::store().
const std::string & fesa::FesaException::getMessage | ( | ) | const |
This method returns the message linked to the error code of the exception.
Definition at line 117 of file FesaException.cpp.
References message_.
Referenced by fesa::AbstractSubscriptionFilter::cycleFirstUpdate(), fesa::SubscriptionFilter::doUpdate(), fesa::FesaDeviceServer::get(), fesa::FesaDeviceServer::monitorOff(), fesa::FesaDeviceServer::monitorOn(), fesa::NotificationThread::NotificationThread(), fesa::NotificationConsumer::run(), fesa::OnSubscriptionEventSource::SubscriptionThread::run(), fesa::AbstractEventSource::run(), fesa::PersistencyManager::run(), fesa::RTScheduler::schedule(), fesa::NotificationProducer::sendAutomaticNotification(), fesa::NotificationProducer::sendCommandMessage(), fesa::NotificationProducer::sendManualNotification(), fesa::FesaDeviceServer::set(), and fesa::OnSubscriptionEventSource::startSubscriptions().
void fesa::FesaException::loadMessagesFile | ( | const std::string & | file | ) | [protected, virtual] |
This method loads all the messages from the file and puts them into a key map <errorCode,message>.
Definition at line 166 of file FesaException.cpp.
References FesaException(), and messages_.
Referenced by preloadMessages().
void fesa::FesaException::preloadMessages | ( | ) |
This method preload all the messages to avoid to do it runtime.
Definition at line 139 of file FesaException.cpp.
References fesa::AbstractEquipment::getInstance(), fesa::ProcessConfiguration::getLabMsgConfigFile(), fesa::ProcessConfiguration::getMsgConfigFile(), fesa::AbstractEquipment::getProcessConfiguration(), loadMessagesFile(), and messagesLoaded_.
Referenced by buildMessage().
const char * fesa::FesaException::what | ( | ) | const throw () |
Definition at line 112 of file FesaException.cpp.
References message_.
std::string fesa::FesaException::errorCode_ [protected] |
error code
Definition at line 112 of file FesaException.h.
Referenced by buildMessage(), fesa::FesaBadConfigException::FesaBadConfigException(), fesa::FesaBadParameterException::FesaBadParameterException(), fesa::FesaFileException::FesaFileException(), fesa::FesaInvalidResourceException::FesaInvalidResourceException(), fesa::FesaIOException::FesaIOException(), fesa::FesaTypeMismatchException::FesaTypeMismatchException(), getErrorCode(), and getErrorCodeAsLong().
std::string fesa::FesaException::file_ [protected] |
file, where the error comes from
Definition at line 117 of file FesaException.h.
Referenced by buildMessage(), fesa::FesaBadConfigException::FesaBadConfigException(), fesa::FesaBadParameterException::FesaBadParameterException(), fesa::FesaFileException::FesaFileException(), fesa::FesaInvalidResourceException::FesaInvalidResourceException(), fesa::FesaIOException::FesaIOException(), fesa::FesaTypeMismatchException::FesaTypeMismatchException(), and getFileName().
int32_t fesa::FesaException::lineNumber_ [protected] |
line number, where the error was thrown
Definition at line 122 of file FesaException.h.
Referenced by buildMessage(), fesa::FesaBadConfigException::FesaBadConfigException(), fesa::FesaBadParameterException::FesaBadParameterException(), fesa::FesaFileException::FesaFileException(), fesa::FesaInvalidResourceException::FesaInvalidResourceException(), fesa::FesaIOException::FesaIOException(), fesa::FesaTypeMismatchException::FesaTypeMismatchException(), and getLineNumber().
std::string fesa::FesaException::message_ [protected] |
message to return
Definition at line 107 of file FesaException.h.
Referenced by buildMessage(), getMessage(), and what().
std::map< std::string, std::string > fesa::FesaException::messages_ [static, protected] |
<ErrorCode, Message> This attribute contains the relation between the exception code and the message
Definition at line 128 of file FesaException.h.
Referenced by buildMessage(), and loadMessagesFile().
bool fesa::FesaException::messagesLoaded_ = false [static, protected] |
Definition at line 130 of file FesaException.h.
Referenced by preloadMessages().