DotNetDupe 4.0.6
C++17/20 Implementation of the .NET Base Class Library (BCL)
Loading...
Searching...
No Matches
Exception.cpp
Go to the documentation of this file.
1#include "pch.h"
2#include "System/Exception.h"
4#include "System/String.h"
10
11#include <cstring>
12
13namespace DotNetDupe {
14 namespace System {
15 Exception::Exception() : std::runtime_error("Exception of type 'DotNetDupe::System::Exception' was thrown.") {
17 }
18
19 Exception::Exception(const String& sMessage) : std::runtime_error(sMessage.GetRawString() ? sMessage.GetRawString() : "") {
21 }
22
23 Exception::Exception(const String& sMessage, const Exception& innerException)
24 : std::runtime_error(sMessage.GetRawString() ? sMessage.GetRawString() : ""), m_pInnerException(new Exception(innerException)) {
26 }
27
29 : std::runtime_error(other), m_pInnerException(other.m_pInnerException ? new Exception(*other.m_pInnerException) : nullptr) {
31 }
32
35 if (this != &other) {
36 std::runtime_error::operator=(other);
37 delete m_pInnerException;
38 m_pInnerException = other.m_pInnerException ? new Exception(*other.m_pInnerException) : nullptr;
39 }
40 return *this;
41 }
42
45 delete m_pInnerException;
46 }
47
50 SystemException::SystemException(const String& message, const Exception& innerException) : Exception(message, innerException) {}
51
52 UnauthorizedAccessException::UnauthorizedAccessException() : SystemException("Attempted to perform an unauthorized operation.") {}
53 UnknownException::UnknownException() : SystemException("An unknown or unhandled non-DotNetDupe exception occurred.") {}
54 OutOfMemoryException::OutOfMemoryException() : SystemException("Insufficient memory to continue the execution of the program.") {}
55 Security::SecurityException::SecurityException() : SystemException("A security error has been detected.") {}
56 IO::IOException::IOException() : SystemException("I/O error occurred.") {}
57 }
58}
Represents errors that occur during application execution and serves as the ultimate base exception.
The exception that is thrown when an I/O error occurs.
The exception that is thrown when there is not enough memory to continue the execution of a program.
Exception thrown when a security error is detected.
High-performance UTF-8 / UTF-16 string manipulation class mirroring .NET System.String.
Serves as the base class for system exceptions across the library.
The exception that is thrown when the operating system denies access because of an I/O error or a spe...
Represents an unknown or unmapped exception encountered during execution.
Exception & operator=(const Exception &other)
Copy assignment operator.
Definition Exception.cpp:33
virtual ~Exception()
Virtual destructor.
Definition Exception.cpp:43
Exception()
Initializes a new instance of the Exception class with a default system-supplied message.
Definition Exception.cpp:15
IOException()
Initializes a new instance of the IOException class with a default message.
Definition Exception.cpp:56
OutOfMemoryException()
Initializes a new instance of the OutOfMemoryException class with a default message.
Definition Exception.cpp:54
SecurityException()
Initializes a new instance of the SecurityException class with default properties.
Definition Exception.cpp:55
Represents text as a sequence of UTF-8 code units with culture-invariant operations.
Definition String.h:74
SystemException()
Initializes a new instance of the SystemException class with a default message.
Definition Exception.cpp:48
UnauthorizedAccessException()
Initializes a new instance of the UnauthorizedAccessException class with a default message.
Definition Exception.cpp:52
UnknownException()
Initializes a new instance of the UnknownException class with a default message.
Definition Exception.cpp:53