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>
Inherits exception.
Inherited by fesa::FesaBadConfigException, fesa::FesaBadParameterException, fesa::FesaFileException, fesa::FesaInvalidResourceException, fesa::FesaIOException, and fesa::FesaTypeMismatchException.
|
| 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, const std::string &arg1=UNDEFINED_EXCEPTION_ARGUMENT, const std::string &arg2=UNDEFINED_EXCEPTION_ARGUMENT, const std::string &arg3=UNDEFINED_EXCEPTION_ARGUMENT, const std::string &arg4=UNDEFINED_EXCEPTION_ARGUMENT, const std::string &arg5=UNDEFINED_EXCEPTION_ARGUMENT, const std::string &arg6=UNDEFINED_EXCEPTION_ARGUMENT) |
| Constructor. More...
|
|
| FesaException (const std::string &file, int32_t lineNumber, const std::string &message) |
| Constructor which can be used without Exception-File. More...
|
|
| FesaException (const std::string &message, const std::string &file, int32_t lineNumber, const std::string &errorCode, const std::string &errorCategory) |
| Constructor which can be used without Exception-File class-developers may inherit from FesaException, and use this constructor to build their message. More...
|
|
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 () const |
| This method returns the the error code of the exception.
|
|
const std::string & | getErrorCategory () const |
| This method returns the the error category of the exception.
|
|
const std::string & | getFileName () const |
| get the file in which the exception occurred
|
|
int32_t | getLineNumber () const |
| line number in which the exception occurred
|
|
long | getErrorCodeAsLong () const |
| This method returns the the error code of the exception as long. More...
|
|
|
static void | loadMessages (const std::string &messagesFileName, const std::string &labMessagesFileName) |
| This method loads all the messages. It should be called before instatiating exceptions, or only error codes will appear in exceptions messages. Not thread-safe. More...
|
|
static void | loadMessagesFile (const std::string &file) |
| This method loads all the messages from the given file. Not thread-safe. More...
|
|
static void | loadMessages (std::istream &input) |
| This method loads all the messages from the given stream. Not thread-safe. More...
|
|
|
void | buildMessage (const std::vector< const std::string * > &arguments) |
|
|
std::string | message_ |
| message to return
|
|
std::string | errorCode_ |
| Some code in order to allow automated identification of the error.
|
|
std::string | errorCategory_ |
| The project/category to which this error belongs.
|
|
std::string | file_ |
| file, where the error comes from
|
|
int32_t | lineNumber_ |
| line number, where the error was thrown
|
|
|
static std::map< std::string,
std::string > | messages_ |
| <ErrorCode, Message> This attribute contains the relation between the exception code and the message
|
|
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 ...
fesa::FesaException::FesaException |
( |
const std::string & |
file, |
|
|
int32_t |
lineNumber, |
|
|
const char * |
errorMessage, |
|
|
const std::string & |
arg1 = UNDEFINED_EXCEPTION_ARGUMENT , |
|
|
const std::string & |
arg2 = UNDEFINED_EXCEPTION_ARGUMENT , |
|
|
const std::string & |
arg3 = UNDEFINED_EXCEPTION_ARGUMENT , |
|
|
const std::string & |
arg4 = UNDEFINED_EXCEPTION_ARGUMENT , |
|
|
const std::string & |
arg5 = UNDEFINED_EXCEPTION_ARGUMENT , |
|
|
const std::string & |
arg6 = UNDEFINED_EXCEPTION_ARGUMENT |
|
) |
| |
Constructor.
- Parameters
-
errorCode | |
file | in which the exception occurred |
line | in which the exception occurred |
errorMessage | to be shown or code associated with it |
arg1 | ... arguments used to build the exception message |
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 |
fesa::FesaException::FesaException |
( |
const std::string & |
message, |
|
|
const std::string & |
file, |
|
|
int32_t |
lineNumber, |
|
|
const std::string & |
errorCode, |
|
|
const std::string & |
errorCategory |
|
) |
| |
Constructor which can be used without Exception-File class-developers may inherit from FesaException, and use this constructor to build their message.
- Parameters
-
message | The final error-message |
file | in which the exception occurred |
line | in which the exception occurred |
errorCode | Some code in order to allow automated identification of the error |
errorCategory | The project/category to which this error belongs |
void fesa::FesaException::buildMessage |
( |
const std::vector< const std::string * > & |
arguments | ) |
|
|
protected |
Builds the exception message with the given arguments.
- Parameters
-
arguments | vector containing the arguments |
long fesa::FesaException::getErrorCodeAsLong |
( |
| ) |
const |
This method returns the the error code of the exception as long.
- Returns
- error code
void fesa::FesaException::loadMessages |
( |
const std::string & |
messagesFileName, |
|
|
const std::string & |
labMessagesFileName |
|
) |
| |
|
static |
This method loads all the messages. It should be called before instatiating exceptions, or only error codes will appear in exceptions messages. Not thread-safe.
- Parameters
-
messagesFileName | name of the file containing the generic exception messages |
labMessagesFileName | name of the file containing the lab specific exception messages |
void fesa::FesaException::loadMessages |
( |
std::istream & |
input | ) |
|
|
static |
This method loads all the messages from the given stream. Not thread-safe.
- Parameters
-
input | the stream containing the messages |
void fesa::FesaException::loadMessagesFile |
( |
const std::string & |
file | ) |
|
|
static |
This method loads all the messages from the given file. Not thread-safe.
- Parameters
-
file | the file containing the messages |
const char * fesa::FesaException::what |
( |
| ) |
const |
throw | ( | |
| ) | | |
- Returns
- a string with the error description
The documentation for this class was generated from the following files:
- FesaException.h
- FesaException.cpp