87 lines
3.3 KiB
C++
87 lines
3.3 KiB
C++
/**
|
|
* @file include/ActivMiddleware/ActivFramework/FrameworkException.h
|
|
*
|
|
* @brief Header file for ActivFramework exception class.
|
|
*/
|
|
|
|
#if (!defined ACTIV_FRAMEWORK_FRAMEWORK_EXCEPTION_H)
|
|
#define ACTIV_FRAMEWORK_FRAMEWORK_EXCEPTION_H
|
|
|
|
#include "ActivMiddleware/ActivFramework/External.h"
|
|
#include "ActivMiddleware/ActivBase/Exception.h"
|
|
|
|
/**
|
|
* @brief The list of possible errors and their strings.
|
|
*
|
|
* Note this list is converted to an enum using the ACTIV_DECLARE_ELEMENT_1 macro in ActivMiddleware.h,
|
|
* and the strings are unpicked using ACTIV_DECLARE_ELEMENT_2.
|
|
*/
|
|
#define ACTIV_FRAMEWORK_EXCEPTION_LIST(d) \
|
|
d(ERROR_FAILED_TO_ALLOC_MESSAGE_ARRAY, "failed to allocate message array") \
|
|
d(ERROR_FAILED_TO_ALLOC_SYSTEM, "failed to allocate system") \
|
|
d(ERROR_FAILED_TO_ALLOC_PROCESS, "failed to allocate process") \
|
|
d(ERROR_FAILED_TO_ALLOC_PROCESS_TABLE, "failed to allocate process table") \
|
|
d(ERROR_PROCESS_DOES_NOT_EXIST, "process does not exist") \
|
|
d(ERROR_FAILED_TO_ALLOC_ENDPOINT, "failed to allocate endpoint") \
|
|
d(ERROR_FAILED_TO_ALLOC_ENDPOINT_TABLE, "failed to allocate endpoint table") \
|
|
d(ERROR_ENDPOINT_DOES_NOT_EXIST, "endpoint does not exist") \
|
|
d(ERROR_FAILED_TO_ALLOC_HEAP, "failed to allocate heap") \
|
|
d(ERROR_FAILED_TO_ALLOC_HEAP_TABLE, "failed to allocate heap table") \
|
|
d(ERROR_HEAP_DOES_NOT_EXIST, "heap does not exist") \
|
|
d(ERROR_INVALID_NUMBER_OF_BUCKETS, "invalid number of buckets") \
|
|
d(ERROR_INVALID_MESSAGE_SIZE, "invalid message size (probably 0)") \
|
|
d(ERROR_INVALID_HEAP_ID, "invalid heap id") \
|
|
d(ERROR_INVALID_ENDPOINT_ID, "invalid endpoint id") \
|
|
d(ERROR_INVALID_PROCESS_ID, "invalid process id") \
|
|
d(ERROR_PORT_ID_IN_USE, "port id in use") \
|
|
d(ERROR_INVALID_PROCESS_STATE, "invalid process state") \
|
|
d(ERROR_UNKNOWN_SYSTEM_LOG_MODE, "unknown system log mode") \
|
|
d(ERROR_INVALID_MEMORY_MODEL, "invalid memory model") \
|
|
d(ERROR_COMPONENT_LIST_FULL, "component list full") \
|
|
d(ERROR_ENDPOINT_NAME_ALREADY_EXISTS, "endpoint name already exists") \
|
|
d(ERROR_ENDPOINT_NAME_TOO_LONG, "endpoint name too long") \
|
|
d(ERROR_HEAP_NAME_ALREADY_EXISTS, "heap name already exists") \
|
|
d(ERROR_HEAP_NAME_TOO_LONG, "heap name too long")
|
|
|
|
//! Activ namespace.
|
|
namespace Activ
|
|
{
|
|
|
|
/**
|
|
* @brief ActivFramework exception class.
|
|
*
|
|
* An exception of class FrameworkException is thrown only by classes inside ActivFramework.
|
|
*/
|
|
class FrameworkException : public Exception
|
|
{
|
|
public:
|
|
/**
|
|
* @brief Enumeration of all FrameworkException errors.
|
|
*/
|
|
enum
|
|
{
|
|
ACTIV_FRAMEWORK_EXCEPTION_LIST(ACTIV_DECLARE_ELEMENT_1_WITH_COMMA)
|
|
NUM_ERRORS
|
|
};
|
|
|
|
/**
|
|
* @brief Constructor.
|
|
*
|
|
* @param file the file which raised the exception
|
|
* @param function the function which raised the exception
|
|
* @param line the line number which raised the exception
|
|
* @param errorCode the exception specific error code
|
|
* @param message the exception message.
|
|
*/
|
|
ACTIV_FRAMEWORK_API
|
|
FrameworkException(const char *file, const char *function, const uint_fast32_t line, const uint_fast32_t errorCode,
|
|
const String &message = "");
|
|
|
|
ACTIV_FRAMEWORK_API
|
|
virtual String ToString() const ACTIV_OVERRIDE;
|
|
};
|
|
|
|
} // namespace Activ
|
|
|
|
#endif // (!defined ACTIV_FRAMEWORK_FRAMEWORK_EXCEPTION_H)
|