PLCnext API Documentation 25.0.2.69
InvalidDataConnectionException.hpp
1
2//
3// Copyright Phoenix Contact GmbH & Co. KG
4//
6#pragma once
8#include "Arp/System/Commons/Exceptions/ArgumentException.hpp"
9
10namespace Arp { namespace System { namespace Commons
11{
12
16{
17public: // construction/destruction
18 template<typename... Args>
19 InvalidDataConnectionException(const char* message, const Args& ... args);
22 InvalidDataConnectionException(const String& message, const Exception& innerException);
23 InvalidDataConnectionException(String&& message, Exception&& innerException);
26 virtual ~InvalidDataConnectionException(void) = default;
27
28public: // static factory methods
29 template<class T>
30 static InvalidDataConnectionException Create(const T& keyValue);
31 template<class T>
32 static InvalidDataConnectionException Create(const T& keyValue, const Exception& innerException);
33
34protected: // overridden operations
35 Exception::Ptr Clone(void)const override;
36
37private: // deleted methods
39
40private:
41 static const char* const defaultMessage;
42};
43
45// inline methods of class InvalidDataConnectionException
46
48template<typename... Args>
49inline InvalidDataConnectionException::InvalidDataConnectionException(const char* message, const Args& ... args)
50 : ArgumentException(ExceptionTypeId::InvalidDataConnection, String::Format(message, args...), StackCounter())
51{
52}
53
54
56template<class T>
58{
59 return InvalidDataConnectionException(defaultMessage, keyValue);
60}
61
63template<class T>
65{
66 return InvalidDataConnectionException(String::Format(defaultMessage, keyValue), innerException);
67}
68
69}}} // end of namesapce Arp::System::Commons
70
72// template specialization of InvalidDataConnectionException formatter
73template<> struct fmt::formatter<Arp::System::Commons::InvalidDataConnectionException> : public fmt::ostream_formatter {};
This exception is thrown when an invalid argument occurs.
Definition: ArgumentException.hpp:17
This class is used to count sequenced operation calls, which are e.g. invoked during an exception thr...
Definition: StackCounter.hpp:20
This is the base class of all Arp exception classes.
Definition: Exception.hpp:21
std::unique_ptr< Exception > Ptr
The smart pointer type of this class.
Definition: Exception.hpp:27
This class represents the Arp String. The implementation is based on std::string.
Definition: String.hpp:39
static String Format(const String &format, const Args &... args)
Formats the format string using the .NET/Python syntax with the given variadic arguments.
Definition: String.inl:18
This exception is thrown when an unsupported GDS data connection occurs.
Definition: InvalidDataConnectionException.hpp:16
InvalidDataConnectionException(const char *message, const Args &... args)
Constructs an InvalidDataConnectionException instance.
Definition: InvalidDataConnectionException.hpp:49
static InvalidDataConnectionException Create(const T &keyValue)
Creates an InvalidDataConnectionException instance using a default message text.
Definition: InvalidDataConnectionException.hpp:57
Exception::Ptr Clone(void) const override
This operation clones this instance polymorpically as a deep copy.
Definition: InvalidDataConnectionException.cpp:15
ExceptionTypeId
Specifies the type id of any exception derived by <see cref="CommonException".
Definition: ExceptionTypeId.hpp:15
Root namespace for the PLCnext API