7#ifndef ARP_USE_ARP_SYSTEM_COMMONS_EXCEPTIONS
8#include "Arp/Base/Commons/Exceptions/ArgumentException.hpp"
15#include "Arp/System/Commons/Exceptions/CommonException.hpp"
17namespace Arp {
namespace System {
namespace Commons
21class ArgumentException :
public CommonException
24 template<
typename... Args>
25 ArgumentException(
const char* message,
const Args& ... args);
26 ArgumentException(
const String& message);
27 ArgumentException(String&& message);
28 ArgumentException(
const String& message,
const Exception& innerException);
29 ArgumentException(String&& message, Exception&& innerException);
30 ArgumentException(
const ArgumentException& arg) =
default;
31 ArgumentException(ArgumentException&& arg) =
default;
32 virtual ~ArgumentException(
void) =
default;
35 ArgumentException(
ExceptionTypeId typeId, String&& message,
int skipStackTraceDepth = 3);
36 ArgumentException(
ExceptionTypeId typeId,
const String& message,
int skipStackTraceDepth = 3);
37 ArgumentException(
ExceptionTypeId typeId, String&& message, Exception&& innerException,
int skipStackTraceDepth = 3);
38 ArgumentException(
ExceptionTypeId typeId,
const String& message,
const Exception& innerException,
int skipStackTraceDepth = 3);
42 static ArgumentException
Create(
const char* paramName,
const T& paramValue);
44 static ArgumentException
Create(
const char* paramName,
const T& paramValue,
const Exception& innerException);
46 static ArgumentException
Create(
const char* paramName,
const T& paramValue,
const char* message);
52 ArgumentException& operator=(
const ArgumentException& arg) =
delete;
55 static const char*
const defaultMessage;
56 static const char*
const defaultMessage2;
63template<
typename... Args>
65 : CommonException(
ExceptionTypeId::Argument, String::Format(message, args...))
70inline ArgumentException::ArgumentException(
const String& message)
71 : CommonException(ExceptionTypeId::Argument, message)
76inline ArgumentException::ArgumentException(String&& message)
77 : CommonException(ExceptionTypeId::Argument,
std::move(message))
82inline ArgumentException::ArgumentException(
const String& message,
const Exception& innerException)
83 : CommonException(ExceptionTypeId::Argument, message, innerException)
88inline ArgumentException::ArgumentException(String&& message, Exception&& innerException)
89 : CommonException(ExceptionTypeId::Argument,
std::move(message),
std::move(innerException))
94inline ArgumentException::ArgumentException(ExceptionTypeId typeId,
const String& message,
int skipStackTraceDepth)
95 : CommonException(typeId, message, skipStackTraceDepth)
100inline ArgumentException::ArgumentException(ExceptionTypeId typeId, String&& message,
int skipStackTraceDepth)
101 : CommonException(typeId,
std::move(message), skipStackTraceDepth)
106inline ArgumentException::ArgumentException(ExceptionTypeId typeId,
const String& message,
const Exception& innerException,
int skipStackTraceDepth)
107 : CommonException(typeId, message, innerException, skipStackTraceDepth)
112inline ArgumentException::ArgumentException(ExceptionTypeId typeId, String&& message, Exception&& innerException,
int skipStackTraceDepth)
113 : CommonException(typeId,
std::move(message),
std::move(innerException), skipStackTraceDepth)
119inline ArgumentException ArgumentException::Create(
const char* paramName,
const T& paramValue)
121 return ArgumentException(defaultMessage, paramName, paramValue);
126ArgumentException ArgumentException::Create(
const char* paramName,
const T& paramValue,
const Exception& innerException)
128 return ArgumentException(String::Format(defaultMessage, paramName, paramValue), innerException);
133ArgumentException ArgumentException::Create(
const char* paramName,
const T& paramValue,
const char* message)
135 return ArgumentException(String::Format(defaultMessage2, paramName, paramValue, message));
142template<>
struct fmt::formatter<
Arp::System::Commons::ArgumentException> :
public fmt::ostream_formatter {};
This exception is thrown when an invalid argument occurs.
Definition: ArgumentException.hpp:17
ArgumentException(const ArgumentException &arg)
Default copy constructor.
std::unique_ptr< Exception > Ptr
The smart pointer type of this class.
Definition: Exception.hpp:27
@ Create
Creates a new file. If the file already exists, it is overwritten.
ExceptionTypeId
Specifies the type id of any exception derived by <see cref="CommonException".
Definition: ExceptionTypeId.hpp:15
Root namespace for the PLCnext API
Namespace of the C++ standard library