fesa::FesaException Class Reference

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>

Inheritance diagram for fesa::FesaException:
fesa::FesaBadConfigException fesa::FesaBadParameterException fesa::FesaFileException fesa::FesaInvalidResourceException fesa::FesaIOException fesa::FesaTypeMismatchException

List of all members.

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

Detailed Description

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.


Constructor & Destructor Documentation

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.

Parameters:
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.

Parameters:
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.


Member Function Documentation

void fesa::FesaException::buildMessage ( va_list  vl  )  [protected]
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 (  ) 
const std::string & fesa::FesaException::getFileName (  )  [inline]
int32_t fesa::FesaException::getLineNumber (  )  [inline]
const std::string & fesa::FesaException::getMessage (  )  const
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 (  ) 
const char * fesa::FesaException::what (  )  const throw ()
Returns:
a string with the error description

Definition at line 112 of file FesaException.cpp.

References message_.


Member Data Documentation

std::string fesa::FesaException::errorCode_ [protected]
std::string fesa::FesaException::file_ [protected]
int32_t fesa::FesaException::lineNumber_ [protected]
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().


The documentation for this class was generated from the following files:

Generated on 18 Jan 2013 for Fesa by  doxygen 1.6.1