PLCnext API Documentation 25.0.2.69
CommonException.hpp
1
2//
3// Copyright Phoenix Contact GmbH & Co. KG
4//
6#pragma once
8#include "Arp/System/Core/Exception.hpp"
9#include "Arp/System/Commons/Runtime/Stacktrace.hpp"
10
11namespace Arp { namespace System { namespace Commons
12{
13
14using namespace Arp::System::Commons::Runtime;
15
18{
19public: // usings
21
22protected: // construction/destruction
23 CommonException(ExceptionTypeId typeId, const String& message, int skipStackTraceDepth = 0);
24 CommonException(ExceptionTypeId typeId, String&& message, int skipStackTraceDepth = 0);
25 CommonException(ExceptionTypeId typeId, const String& message, const Exception& innerException, int skipStackTraceDepth = 0);
26 CommonException(ExceptionTypeId typeId, String&& message, Exception&& innerException, int skipStackTraceDepth = 0);
27 CommonException(ExceptionTypeId typeId, String&& message, Exception::Ptr&& innerExceptionPtr, int skipStackTraceDepth = 0);
28 CommonException(const CommonException& arg) = default;
29 CommonException(CommonException&& arg)noexcept = default;
30 virtual ~CommonException(void) = default;
31
32protected: // overridden operations
33 String Format(/*int indentLevel,*/ bool withInnerException)const override;
34
35private: // deleted methods
36 CommonException& operator=(const CommonException& arg) = delete;
37
38private: // fields
39 Stacktrace stackTrace;
40};
41
42}}} // end of namesapce Arp::System::Commons
43
45// template specialization of CommonException formatter
46template<> struct fmt::formatter<Arp::System::Commons::CommonException> : public fmt::ostream_formatter {};
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
This is the base class of common exception classes.
Definition: CommonException.hpp:18
CommonException(ExceptionTypeId typeId, const String &message, int skipStackTraceDepth=0)
Constructs an CommonException instance.
Definition: CommonException.cpp:17
String Format(bool withInnerException) const override
Formats this exception using the given indent level.
Definition: CommonException.cpp:51
Definition: Stacktrace.hpp:14
Namespace for high level API for controlling processes, shared libraries, etc.
ExceptionTypeId
Specifies the type id of any exception derived by <see cref="CommonException".
Definition: ExceptionTypeId.hpp:15
Root namespace for the PLCnext API