8#ifndef ARP_USE_ARP_SYSTEM_CORE
10#include "Arp/Base/Core/Exception.hpp"
26 typedef std::shared_ptr<Exception>
Ptr;
32 template<
typename... Args>
33 Exception(
const char* message,
const Args& ... args);
92 virtual String
Format(
int indentLevel,
bool withInnerException)
const;
106 const static int indentSize = 3;
107 const static int indentChar =
' ';
108 const static int innerIndentChar =
'-';
113template<
typename... Args>
115 : message(String::Format(messageArg, args...))
119inline Exception::Exception(
const String& messageArg)
120 : message(messageArg)
124inline Exception::Exception(String&& messageArg)
125 : message(
std::move(messageArg))
129inline Exception::Exception(
const String& messageArg,
const Exception& innerException)
130 : message(messageArg), innerExceptionPtr(innerException.Clone())
134inline Exception::Exception(String&& messageArg, Exception&& innerException)
135 : message(
std::move(messageArg)), innerExceptionPtr(innerException.Clone())
139inline Exception::Exception(String&& messageArg,
const Exception::Ptr& innerException)
140 : message(
std::move(messageArg)), innerExceptionPtr(innerException)
144inline const String& Exception::GetMessage()
const
146 return this->message;
149inline bool Exception::HasInnerException()
const
151 return (
bool)this->innerExceptionPtr;
154inline Exception::Ptr Exception::GetInnerException()
const
156 return this->innerExceptionPtr;
159inline uint32 Exception::GetTypeCode()
const
161 return this->GetTypeCodeInternal();
171inline std::ostream& operator<<(std::ostream& os,
const Exception& e)
181template<>
struct fmt::formatter<
Arp::Exception> :
public fmt::ostream_formatter {};
const Exception & GetInnerException(void) const
Gets the inner exception of this exception.
Definition: Exception.cpp:154
virtual Exception::Ptr Clone(void) const
This operation clones this instance polymorphically as a deep copy.
Definition: Exception.cpp:172
bool HasInnerException(void) const
Determines if this exception has an inner exception.
Definition: Exception.cpp:147
std::unique_ptr< Exception > Ptr
The smart pointer type of this class.
Definition: Exception.hpp:27
virtual String Format(bool withInnerException) const
Formats this exception using the given indent level.
Definition: Exception.cpp:180
virtual ~Exception(void)
Default destructor.
Exception(void)
Constructs an empty instance of class Exception.
Definition: Exception.cpp:47
virtual uint32 GetTypeCodeInternal(void) const
DEPRECATED.
Definition: Exception.cpp:220
String ToString(void) const
This operation should be used for logging and returns a reasonable description of the exception cause...
Definition: Exception.cpp:165
Exception & operator=(const Exception &arg)
Default copy-assignment operator.
TypeCode GetTypeCode(void) const
Gets the type code of this exception.
Definition: Exception.cpp:140
const String & GetMessage(void) const
Gets the error message of this exception.
Definition: Exception.cpp:118
std::uint32_t uint32
The Arp unsigned integer type of 4 byte size.
Definition: PrimitiveTypes.hpp:33
Root namespace for the PLCnext API
Namespace of the C++ standard library