rad 6.2.0
|
Base class for the exceptions thrown by RAD and its users. More...
#include <exceptions.hpp>
Public Types | |
typedef std::chrono::system_clock | ClockT |
The clock to use for determining the exception creation time. | |
Public Member Functions | |
Exception (const std::string &message) | |
Constructor. | |
Exception (const std::string &message, const std::string &info) | |
virtual | ~Exception ()=default |
Destructor. | |
const boost::stacktrace::stacktrace & | GetStackTrace () const |
Return the stack trace captured in the exception constructor. | |
const boost::stacktrace::stacktrace & | GetOriginalStackTrace () const |
Return the stack trace captured in the most nested exception constructor. | |
std::string | GetStackTraceAsString () const |
Same as GetStackTrace() but convert the trace to a string. | |
std::string | GetOriginalStackTraceAsString () const |
Same as GetOriginalStackTrace() but convert the trace to a string. | |
std::string | GetFullStackTraceAsString () const |
Return the full stack trace (including nested exceptions) | |
std::chrono::time_point< ClockT > | GetTimePoint () const |
Return the exception creation time as a chrono timepoint. | |
int64_t | GetCreationDate () const |
Return the exception creation time as number of seconds since Unix Epoch. | |
std::thread::id | GetThreadId () const |
Return the id of the thread in which the exception was created. | |
int | GetProcessId () const |
Return the id of the process in which the exception was created. | |
std::string | GetHostName () const |
Return the name of the host in which the exception was created. | |
std::string | GetTypeName () const |
Return the exception class name. | |
void | SetLineNumber (uint32_t line_number) |
Set the line number in which the exception was thrown. | |
uint32_t | GetLineNumber () const |
Return the line number in which the exception was thrown. | |
void | SetFunctionName (const std::string &function_name) |
Set the name of the function in which the exception was thrown. | |
const std::string & | GetFunctionName () const |
Return the name of the function in which the exception was thrown. | |
void | SetFileName (const std::string &file_name) |
Set the name of the file in which the exception was thrown. | |
const std::string & | GetFileName () const |
Return the name of the file in which the exception was thrown. | |
void | SetDetails (const std::string &details) |
Set the exception details. | |
std::string | GetDetails () const |
Get the exception details. | |
void | SetClassName (const std::string &class_name) |
Set the name of the class in which the exception was thrown. | |
void | SetExceptionStack (const std::vector< std::string > &nested_exceptions) |
Set the nested exceptions as strings. | |
std::vector< std::string > | GetExceptionStack () const |
Retrieves the nested exception stack as string. | |
std::string | Dump () const |
Return the exception's details. | |
std::string | DumpWithNested () const |
Return all the exception's details including details of nested exceptions. | |
virtual const char * | what () const noexcept override |
Return the exception message. | |
Base class for the exceptions thrown by RAD and its users.
This class is similar to the CII Exception class. The main differences are:
Mapping to CiiSerializableException (see /elt/ciisrv/include/CiiSerializableException.hpp) used to propagate an exception via CII/MAL: std::string ciiType -> GetTypeName() std::string ciiMethodName -> m_attrs->function_name std::string ciiClassName -> m_attrs->class_name std::string ciiFileName -> m_attrs->file_name std::string ciiHostName -> GetHostName() std::string ciiStackTrace -> std::vector<std::string> ciiExceptionStack -> m_attrs->exception_stack std::string ciiMessage -> m_attrs->message std::string ciiDetails -> m_attrs->details int64_t ciiCreationDate -> GetCreationDate()
typedef std::chrono::system_clock rad::Exception::ClockT |
The clock to use for determining the exception creation time.
Possible values:
|
explicit |
Constructor.
message | a message describing the error |
|
explicit |
|
virtualdefault |
Destructor.
std::string rad::Exception::Dump | ( | ) | const |
Return the exception's details.
std::string rad::Exception::DumpWithNested | ( | ) | const |
Return all the exception's details including details of nested exceptions.
int64_t rad::Exception::GetCreationDate | ( | ) | const |
Return the exception creation time as number of seconds since Unix Epoch.
std::string rad::Exception::GetDetails | ( | ) | const |
Get the exception details.
std::vector< std::string > rad::Exception::GetExceptionStack | ( | ) | const |
Retrieves the nested exception stack as string.
const std::string & rad::Exception::GetFileName | ( | ) | const |
Return the name of the file in which the exception was thrown.
std::string rad::Exception::GetFullStackTraceAsString | ( | ) | const |
Return the full stack trace (including nested exceptions)
const std::string & rad::Exception::GetFunctionName | ( | ) | const |
Return the name of the function in which the exception was thrown.
std::string rad::Exception::GetHostName | ( | ) | const |
Return the name of the host in which the exception was created.
uint32_t rad::Exception::GetLineNumber | ( | ) | const |
Return the line number in which the exception was thrown.
const boost::stacktrace::stacktrace & rad::Exception::GetOriginalStackTrace | ( | ) | const |
Return the stack trace captured in the most nested exception constructor.
std::string rad::Exception::GetOriginalStackTraceAsString | ( | ) | const |
Same as GetOriginalStackTrace() but convert the trace to a string.
int rad::Exception::GetProcessId | ( | ) | const |
Return the id of the process in which the exception was created.
const boost::stacktrace::stacktrace & rad::Exception::GetStackTrace | ( | ) | const |
Return the stack trace captured in the exception constructor.
std::string rad::Exception::GetStackTraceAsString | ( | ) | const |
Same as GetStackTrace() but convert the trace to a string.
std::thread::id rad::Exception::GetThreadId | ( | ) | const |
Return the id of the thread in which the exception was created.
std::chrono::time_point< Exception::ClockT > rad::Exception::GetTimePoint | ( | ) | const |
Return the exception creation time as a chrono timepoint.
std::string rad::Exception::GetTypeName | ( | ) | const |
Return the exception class name.
void rad::Exception::SetClassName | ( | const std::string & | class_name | ) |
Set the name of the class in which the exception was thrown.
class_name | the name of the class in which the exception was thrown. |
void rad::Exception::SetDetails | ( | const std::string & | details | ) |
Set the exception details.
details | new exception details |
void rad::Exception::SetExceptionStack | ( | const std::vector< std::string > & | nested_exceptions | ) |
Set the nested exceptions as strings.
nested_exceptions | Nested exceptions as string. |
void rad::Exception::SetFileName | ( | const std::string & | file_name | ) |
Set the name of the file in which the exception was thrown.
fileName | the name of the file in which the exception was thrown |
void rad::Exception::SetFunctionName | ( | const std::string & | function_name | ) |
Set the name of the function in which the exception was thrown.
functionName | the name of the function in which the exception was thrown |
void rad::Exception::SetLineNumber | ( | uint32_t | line_number | ) |
Set the line number in which the exception was thrown.
lineNumber | the line number in which the exception was thrown |
|
overridevirtualnoexcept |
Return the exception message.