ADTF
Loading...
Searching...
No Matches
error_handling_intf.h
Go to the documentation of this file.
1
7#pragma once
9
10namespace adtf
11{
12namespace base
13{
14namespace elasto
15{
16
23{
24 public:
25 ADTF_IID(IErrorHandling, "error_handling.elasto.services.adtf.iid");
26
27 public:
31 enum class tAction: uint32_t
32 {
33 Ignore = 0,
38 };
39
44 {
45 public:
46 ADTF_IID(IErrorHandler, "error_handler.error_handling.elasto.services.adtf.iid");
47
48 public:
54 virtual void Handle(tResult oError) = 0;
55
56 protected:
57 ~IErrorHandler() = default;
58 };
59
60 public:
61
70 virtual tResult CreateErrorHandler(const char* strErrorSource,
71 const char* strErrorCategory,
72 tAction eDefaultAction,
74
75 protected:
76 ~IErrorHandling() = default;
77};
78
82class cErrorHandler: public ucom::catwo::object<IErrorHandling::IErrorHandler>
83{
84 public:
91 cErrorHandler(const char* strErrorSource,
92 const char* strErrorCategory,
94
98 void Handle(tResult oError) override;
99
104
110
114 const char* GetErrorSource() const;
115
119 const char* GetErrorCategory() const;
120
121 private:
122 A_UTILS_D(cErrorHandler)
123};
124
133 const char* strErrorCategory,
134 IErrorHandling::tAction eDefaultAction);
135
143void handle_error(const char* strErrorSource,
144 const char* strErrorCategory,
145 IErrorHandling::tAction eDefaultAction,
146 tResult oError);
147
148}
149
150namespace flash
151{
152
157{
158 public:
163 {}
164
171 inline cErrorChecker(const char* strErrorSource,
172 const char* strErrorCategory,
173 elasto::IErrorHandling::tAction eDefaultAction):
174 m_pErrorHandler(elasto::create_error_handler(strErrorSource,
175 strErrorCategory,
176 eDefaultAction))
177 {}
178
184 void Create(const char* strErrorSource,
185 const char* strErrorCategory,
186 elasto::IErrorHandling::tAction eDefaultAction)
187 {
188 m_pErrorHandler = elasto::create_error_handler(strErrorSource,
189 strErrorCategory,
190 eDefaultAction);
191 }
192
197 inline void Check(tResult oResult)
198 {
199 if (IS_FAILED(oResult) && m_pErrorHandler)
200 {
201 m_pErrorHandler->Handle(oResult);
202 }
203 }
204
205 private:
207};
208
209}
210
211using elasto::IErrorHandling;
212using elasto::cErrorHandler;
215using flash::cErrorChecker;
216
217}
218}
#define ADTF_IID(_interface, _striid)
Definition adtf_iid.h:19
#define IS_FAILED(s)
Check if result is failed.
Definition result.h:20
A_UTILS_NS::cResult tResult
For backwards compatibility and to bring latest version into scope.
Definition result.h:736
cErrorChecker()
Default CTOR.
Definition error_handling_intf.h:162
cErrorHandler(const char *strErrorSource, const char *strErrorCategory, IErrorHandling::tAction eAction)
Definition error_handling_intf.h:44
Definition error_handling_intf.h:23
virtual tResult CreateErrorHandler(const char *strErrorSource, const char *strErrorCategory, tAction eDefaultAction, ucom::ant::iobject_ptr< IErrorHandler > &pHandler)=0
tAction
Definition error_handling_intf.h:32
@ Stop
log error and stop the session.
Definition error_handling_intf.h:35
@ Shutdown
log error and shutdown ADTF.
Definition error_handling_intf.h:36
@ Abort
abort and create a stack trace.
Definition error_handling_intf.h:37
@ Log
log as warning.
Definition error_handling_intf.h:34
@ Ignore
do nothing.
Definition error_handling_intf.h:33
const char * GetErrorCategory() const
IErrorHandling::tAction GetAction() const
void Handle(tResult oError) override
void SetAction(IErrorHandling::tAction eAction)
const char * GetErrorSource() const
cErrorHandler(const char *strErrorSource, const char *strErrorCategory, IErrorHandling::tAction eAction)
void Check(tResult oResult)
Checks the result and handle sit at error handler.
Definition error_handling_intf.h:197
cErrorChecker(const char *strErrorSource, const char *strErrorCategory, elasto::IErrorHandling::tAction eDefaultAction)
CTOR which creates a error handler for the given values.
Definition error_handling_intf.h:171
void Create(const char *strErrorSource, const char *strErrorCategory, elasto::IErrorHandling::tAction eDefaultAction)
Creates a error handler for the given values.
Definition error_handling_intf.h:184
cErrorChecker()
Default CTOR.
Definition error_handling_intf.h:162
Definition object_intf.h:33
Base object pointer to realize binary compatible reference counting in interface methods.
Definition object_ptr_intf.h:112
Definition object_ptr.h:384
Definition object.h:397
Namespace for all functionality of the ADTF Base SDK provided since v3.4.
Definition error_handling_intf.h:15
void handle_error(const char *strErrorSource, const char *strErrorCategory, IErrorHandling::tAction eDefaultAction, tResult oError)
ucom::ant::object_ptr< IErrorHandling::IErrorHandler > create_error_handler(const char *strErrorSource, const char *strErrorCategory, IErrorHandling::tAction eDefaultAction)
Namespace for all functionality of the ADTF Base SDK provided since v3.5.
Definition chrono.h:19
Namespace for the ADTF Base SDK.
Definition adtf_base_type_traits.h:13
ucom::ant::object_ptr< IErrorHandling::IErrorHandler > create_error_handler(const char *strErrorSource, const char *strErrorCategory, IErrorHandling::tAction eDefaultAction)
Namespace for all functionality provided by ADTF and its SDKs.
Definition adtf_client_connector.h:14