|
TrueReality
v0.1.1912
|
This is the exception class used throughout the engine. More...
#include <Exception.h>

Public Member Functions | |
| Exception (const std::string &message, const std::string &filename, unsigned int linenum) | |
| Constructor - Initializes the exception and logs it. More... | |
| virtual | ~Exception () |
| Destructor. More... | |
| const std::string & | What () const |
| The message to be displayed when this exception is thrown. More... | |
| const std::string & | File () const |
| The filename associated with this exception. More... | |
| unsigned int | Line () const |
| The line number associated with this exception. More... | |
| std::string | ToString () const |
| Converts this exception to a string. More... | |
| void | Print () const |
| Prints the exception to the console. More... | |
| void | LogException (trUtil::Logging::LogLevel level=trUtil::Logging::LogLevel::LOG_ERROR) const |
| Logs the exception to the default logger. More... | |
| void | LogException (trUtil::Logging::LogLevel level, const std::string &loggerName) const |
| Logs the exception to the following log level using the logger. More... | |
| void | LogException (trUtil::Logging::LogLevel level, trUtil::Logging::Log &logger) const |
| Logs the exception to the following log level using the given logger. More... | |
Private Attributes | |
| std::string | mMessage |
| std::string | mFileName |
| unsigned int | mLineNum |
This is the exception class used throughout the engine.
Users should derive and create concrete instances.
Definition at line 48 of file Exception.h.
| trUtil::Exception::Exception | ( | const std::string & | message, |
| const std::string & | filename, | ||
| unsigned int | linenum | ||
| ) |
Constructor - Initializes the exception and logs it.
| message | - Message to display about the exception. |
| filename | - File the exception was thrown from. |
| linenum | - Line number in the file from which the exception was thrown. |
Definition at line 34 of file Exception.cpp.
References trUtil::Logging::Log::GetInstance(), LOG_DEBUG, and LogException().

|
virtual |
Destructor.
Definition at line 82 of file Exception.cpp.
| const std::string & trUtil::Exception::File | ( | ) | const |
The filename associated with this exception.
Definition at line 94 of file Exception.cpp.
References mFileName.
| unsigned int trUtil::Exception::Line | ( | ) | const |
The line number associated with this exception.
Definition at line 100 of file Exception.cpp.
References mLineNum.
| void trUtil::Exception::LogException | ( | trUtil::Logging::LogLevel | level = trUtil::Logging::LogLevel::LOG_ERROR | ) | const |
Logs the exception to the default logger.
| level | (Optional) The level/type of logging. |
Definition at line 60 of file Exception.cpp.
References trUtil::Logging::Log::GetInstance().
Referenced by trUtil::PathUtils::CreateDataPathTree(), trUtil::PathUtils::CreateDataPathTrees(), trUtil::PathUtils::CreateUserDataPathTree(), trUtil::FileUtils::DirDelete(), Exception(), trUtil::VersionUtil::GetCurrentCommitNum(), LogException(), main(), trUtil::JSON::File::ReadFromFile(), and trUtil::JSON::File::WriteToFile().


| void trUtil::Exception::LogException | ( | trUtil::Logging::LogLevel | level, |
| const std::string & | loggerName | ||
| ) | const |
Logs the exception to the following log level using the logger.
| level | The level/type of logging. |
| loggerName | the name passed to "getInstance" of the Logger. |
Definition at line 66 of file Exception.cpp.
References trUtil::Logging::Log::GetInstance(), and LogException().

| void trUtil::Exception::LogException | ( | trUtil::Logging::LogLevel | level, |
| trUtil::Logging::Log & | logger | ||
| ) | const |
Logs the exception to the following log level using the given logger.
| level | The level/type of logging. | |
| [in,out] | logger | the actual log instance used to log. |
Definition at line 72 of file Exception.cpp.
References trUtil::Logging::Log::IsLevelEnabled(), trUtil::Logging::Log::LogMessage(), mFileName, mLineNum, and mMessage.

| void trUtil::Exception::Print | ( | ) | const |
Prints the exception to the console.
Definition at line 44 of file Exception.cpp.
| std::string trUtil::Exception::ToString | ( | ) | const |
Converts this exception to a string.
The string contains the reason, line number and file the exception was thrown from.
Definition at line 52 of file Exception.cpp.
References mFileName, mLineNum, and mMessage.
Referenced by trUtil::DirectoryPush::DirectoryPush(), main(), and trUtil::operator<<().

| const std::string & trUtil::Exception::What | ( | ) | const |
The message to be displayed when this exception is thrown.
Definition at line 88 of file Exception.cpp.
References mMessage.
|
private |
Definition at line 144 of file Exception.h.
Referenced by File(), LogException(), Print(), and ToString().
|
private |
Definition at line 145 of file Exception.h.
Referenced by Line(), LogException(), Print(), and ToString().
|
private |
Definition at line 144 of file Exception.h.
Referenced by LogException(), Print(), ToString(), and What().