theKernel 10.0
Loading...
Searching...
No Matches
MkErrorC_CC_API

MkErrorC - the class known as err or error is used to create and manage an error message … More...

+ Collaboration diagram for MkErrorC_CC_API:

Topics

 MkErrorC_TOR_CC_API
 MkErrorC - various functions to 'create' and 'delete' a MkErrorS
 
 MkErrorC_System_CC_API
 MkErrorC - various functions to raise a 'System' messagen on MkErrorS
 
 MkErrorC_Signal_CC_API
 MkErrorC - various functions to set and check a 'signal' on a MkErrorS
 
 MkErrorC_Get_CC_API
 MkErrorC - various functions to 'get' data out of a MkErrorS
 
 MkErrorC_Raise_CC_API
 MkErrorC - various functions to 'raise' a MkErrorS
 
 MkErrorC_Misc_CC_API
 MkErrorC - various functions to 'work' on a MkErrorS
 
 MkErrorC_Introspection_CC_API
 
 MkErrorC_Class_CC_API
 MkErrorC - define the class …
 

Classes

struct  ccmkkernel::MkErrorC_A
 The data-type to store and handle the error-condition … → C-API: libmkkernel::MkErrorS More...
 
class  ccmkkernel::MkErrorC
 The data-type to store and handle the error-condition … → C-API: libmkkernel::MkErrorS More...
 

Functions

 ccmkkernel::MkErrorC::MkErrorC (MK_ERR hdl)
 
static MkErrorCccmkkernel::MkErrorC::MkErrorC_ObjNew (MK_RT_ARGS MK_ERR hdl)
 return MkErrorC from LibMsgqueObject
 
MK_ERR ccmkkernel::MkErrorC::getERR () const
 return the LibMsgqueObject from current MkErrorC instance
 
MK_ERR ccmkkernel::MkErrorC::getERR__null_allow () const
 return the LibMsgqueObject from current MkErrorC instance
 
MK_ERRN ccmkkernel::MkErrorC::getERRN () const
 (const) return the LibMsgqueObject from current MkErrorC instance
 
MK_ERRN ccmkkernel::MkErrorC::getERRN__null_allow () const
 (const) return the LibMsgqueObject from current MkErrorC instance
 
static MK_ERR ccmkkernel::MkErrorC::getERR (MkErrorC *clsHdl)
 return LibMsgqueObject from current MkErrorC pointer
 
static MK_ERR ccmkkernel::MkErrorC::getERR__null_allow (MkErrorC *clsHdl)
 return LibMsgqueObject from current MkErrorC pointer
 
static MK_ERRN ccmkkernel::MkErrorC::getERRN (const MkErrorC *clsHdl)
 (const) return LibMsgqueObject from current MkErrorC pointer
 
static MK_ERRN ccmkkernel::MkErrorC::getERRN__null_allow (const MkErrorC *clsHdl)
 (const) return LibMsgqueObject from current MkErrorC pointer
 
static MK_ERR ccmkkernel::MkErrorC::getERR (const MkErrorC &clsHdl)
 return LibMsgqueObject from current MkErrorC reference
 
static MK_ERR ccmkkernel::MkErrorC::getERR__null_allow (const MkErrorC &clsHdl)
 return LibMsgqueObject from current MkErrorC reference
 
static MK_ERRN ccmkkernel::MkErrorC::getERRN (const MkErrorC &clsHdl)
 (const) return LibMsgqueObject from current MkErrorC reference
 
static MK_ERRN ccmkkernel::MkErrorC::getERRN__null_allow (const MkErrorC &clsHdl)
 (const) return LibMsgqueObject from current MkErrorC reference
 
bool ccmkkernel::MkErrorC::Check () const
 check if pointer is still valid
 
 ccmkkernel::MkErrorC::MkErrorC (const MkErrorC &e)
 
 ccmkkernel::MkErrorC::MkErrorC (const MkExceptionC &ex)
 
static void ccmkkernel::MkErrorC::Check (MK_MNGN mng, enum MkErrorE err)
 
static void ccmkkernel::MkErrorC::Check (enum MkErrorE err)
 
static MkErrorCccmkkernel::MkErrorC::FORMAT (MK_OBJ const fmtobj)
 
static bool ccmkkernel::MkErrorC::IsEXIT_DEFAULT ()
 
static bool ccmkkernel::MkErrorC::IsSOCKET_DEFAULT ()
 

Variables

static thread_local MkErrorC ccmkkernel::MkErrorC::MK_NULL_REF = {(MK_OBJ)0}
 
#define ErrorCC(errnum, message)
 customized edition of ErrorSetV
 

Detailed Description

MkErrorC - the class known as err or error is used to create and manage an error message …

An error is a singleton object per thread created at startup and is located at MkRuntimeRLS using the datatype MkErrorC.

‍As error-indicator the enum libmkkernel::MkErrorE is used.

The MkErrorC is used to collect all data needed to handle an error and provide global ressources required to process and report the error.

The MkErrorC is also used to integrate the error-handling from ccmkkernel into the error-handling-code of the target C++.

Example from Filter6.cc use MqContextErrorCatch to convert a C++ error into a ccmkkernel error

int MK_CDECL main (int argc, MK_STRN argv[])
{
  MqMsgque::CcMqSetup();
  // define factory
  auto Filter6F = MqFactoryCT<Filter6>::Add("Filter6");
  // modify default type
  Filter6F->Type()->fHelp = Filter6::Help;
  // create object from factory
  Filter6 *filter = Filter6F->New();
  try {
    filter->LinkCreate (MkBufferListC {argc, argv});
    filter->ProcessEvent (MQ_WAIT_FOREVER);
  } catch (const exception& e) {
    filter->ErrorCatch(e);
  }
  return filter->Exit();
}

MkExceptionC

MkExceptionC - The default-exception of the Programming-Language-Micro-Kernel (PLMK)

The Programming-Language-Micro-Kernel (PLMK) provide with MkErrorC a complete error-handling with focus to support the "C" Programming-Language. The support include catch, raise, signal and attributes. In addition every Target-Programming-Language (TPL) add their own error-handling and the purpose of MkExceptionC is to integrate the MkErrorC into the Target-Programming-Language (TPL).

The default-exception MkExceptionC is used to connect the MkErrorC with the Target-Programming-Language (TPL) error-object.

The implementation of an exception depends heavily on the Target-Programming-Language (TPL), starting with no exception at all, for example. C, an exception as a class object, or as an exception as a global attribute.

Attention

ExceptionCheck

Checks if Exception is of type MkExceptionC and returns true or false

Example: test case to check KILL and RECOVER feature, check on MkExceptionC

            MK_I32 PID, RET=0;
            auto VAL = ReadBUF();
            Client cl;
            cl.LinkCreate(ConfigGetStartAs());
            cl.Send("W","GPID@I", &PID);
            SysKill(PID,9);
            for (int i = 0; i < 3; i++) {
              try {
                cl.Send("W","ECOI:U@I", VAL, &RET);
              } catch (const MkExceptionC &ex) {
                auto err = cl.ErrorCatch(ex);
                if (err->IsSOCKET()) {
                  err->Reset();
                  cl.LinkConnect();
                  continue;
                } else {
                  err->Raise();
                }
              }
              break;
            }
            SendSTART();
            SendI32(RET);
Returns
the result of the check, true or false
Parameters
[in]exceptionthe exception object from C++, if MK_NULL the global exception object is used

Macro Definition Documentation

◆ ErrorCC

#define ErrorCC ( errnum,
message )
Value:
MkErrorSetV(hdl,__func__,MK_ERROR,errnum,message)
#define MkErrorSetV(...)

customized edition of ErrorSetV

Definition at line 268 of file MkObjectC_cc.hh.

268 #define ErrorCC(errnum,message) \
269 MkErrorSetV(hdl,__func__,MK_ERROR,errnum,message)

Function Documentation

◆ Check() [1/3]

bool ccmkkernel::MkErrorC::Check ( ) const
inline

check if pointer is still valid

Definition at line 150 of file MkErrorC_cc.hh.

150 {
151 return (hdl && MkErrCheck(hdl));
152 };
static bool MkErrCheck(MK_MNGN mng)
check MkErrorS -> libmkkernel::MkObjectS::signature …

◆ Check() [2/3]

static void ccmkkernel::MkErrorC::Check ( enum MkErrorE err)
inlinestatic

Definition at line 171 of file MkErrorC_cc.hh.

171 {
173 }
#define MkErrorCheckI(err)
#define MK_ERROR_DEFAULT_NULL
static void Raise(MK_MNGN const expobj, MK_STRN const callfunc=__builtin_FUNCTION(), MK_I32 const callline=__builtin_LINE())
convert an MkErrorC into a Target-Programming-Language (TPL) exception … → C-API: libmkkernel::MkE...

◆ Check() [3/3]

static void ccmkkernel::MkErrorC::Check ( MK_MNGN mng,
enum MkErrorE err )
inlinestatic

Definition at line 167 of file MkErrorC_cc.hh.

167 {
168 if (MkErrorCheckI(err)) MkExceptionC::Raise(mng);
169 }

◆ FORMAT()

MkErrorC *MK_DECL ccmkkernel::MkErrorC::FORMAT ( MK_OBJ const fmtobj)
inlinestatic

Definition at line 27 of file MkErrorC_inline_cc.hh.

27 {
28 MK_ERR retVal = MkErrorFORMAT (fmtobj);
29 if (retVal == NULL) {
30 throw MkConstructorNullExceptionC("MkErrorC::FORMAT");
31 }
32 MkRtSetup_XN(retVal);
34 }
static MkErrorC * MkErrorC_ObjNew(MK_RT_ARGS MK_ERR hdl)
return MkErrorC from LibMsgqueObject
struct MkErrorS * MK_ERR
class-shortcut for struct MkErrorS *, all shortcut using the XX_YYY syntax (only for public API) …
MK_ERR MkErrorFORMAT(MK_OBJN fmtobj)
system-error-format - format and return the default-error …
#define MkRtSetup_XN(x)
#define MK_RT_CALL

◆ getERR() [1/3]

MK_ERR ccmkkernel::MkErrorC::getERR ( ) const
inline

return the LibMsgqueObject from current MkErrorC instance

Definition at line 82 of file MkErrorC_cc.hh.

82 {
83 MK_ERR ret = reinterpret_cast<MK_ERR>(hdl);
84 if (unlikely(ret == NULL)) InstHdlIsNullError();
85 return ret;
86 };
#define InstHdlIsNullError()
#define unlikely(x)
+ Here is the caller graph for this function:

◆ getERR() [2/3]

static MK_ERR ccmkkernel::MkErrorC::getERR ( const MkErrorC & clsHdl)
inlinestatic

return LibMsgqueObject from current MkErrorC reference

Definition at line 130 of file MkErrorC_cc.hh.

130 {
131 return clsHdl.getERR();
132 };

◆ getERR() [3/3]

static MK_ERR ccmkkernel::MkErrorC::getERR ( MkErrorC * clsHdl)
inlinestatic

return LibMsgqueObject from current MkErrorC pointer

Definition at line 106 of file MkErrorC_cc.hh.

106 {
107 MK_ERR ret = clsHdl ? reinterpret_cast<MK_ERR>(clsHdl->hdl) : NULL;
108 if (unlikely(ret == NULL)) ClassHdlIsNullError(MkErrorC);
109 return ret;
110 };
#define ClassHdlIsNullError(cls)

◆ getERR__null_allow() [1/3]

MK_ERR ccmkkernel::MkErrorC::getERR__null_allow ( ) const
inline

return the LibMsgqueObject from current MkErrorC instance

Definition at line 89 of file MkErrorC_cc.hh.

89 {
90 return reinterpret_cast<MK_ERR>(hdl);
91 };
+ Here is the caller graph for this function:

◆ getERR__null_allow() [2/3]

static MK_ERR ccmkkernel::MkErrorC::getERR__null_allow ( const MkErrorC & clsHdl)
inlinestatic

return LibMsgqueObject from current MkErrorC reference

Definition at line 135 of file MkErrorC_cc.hh.

135 {
136 return clsHdl.getERR__null_allow();
137 };

◆ getERR__null_allow() [3/3]

static MK_ERR ccmkkernel::MkErrorC::getERR__null_allow ( MkErrorC * clsHdl)
inlinestatic

return LibMsgqueObject from current MkErrorC pointer

Definition at line 113 of file MkErrorC_cc.hh.

113 {
114 return clsHdl ? reinterpret_cast<MK_ERR>(clsHdl->hdl) : NULL;
115 };

◆ getERRN() [1/3]

MK_ERRN ccmkkernel::MkErrorC::getERRN ( ) const
inline

(const) return the LibMsgqueObject from current MkErrorC instance

Definition at line 94 of file MkErrorC_cc.hh.

94 {
95 MK_ERRN ret = reinterpret_cast<MK_ERRN>(hdl);
96 if (unlikely(ret == NULL)) InstHdlIsNullError();
97 return ret;
98 };
const struct MkErrorS * MK_ERRN
class-shortcut for const struct MkErrorS *, all const shortcut using the XX_YYYC syntax (only for pub...
+ Here is the caller graph for this function:

◆ getERRN() [2/3]

static MK_ERRN ccmkkernel::MkErrorC::getERRN ( const MkErrorC & clsHdl)
inlinestatic

(const) return LibMsgqueObject from current MkErrorC reference

Definition at line 140 of file MkErrorC_cc.hh.

140 {
141 return clsHdl.getERRN();
142 };

◆ getERRN() [3/3]

static MK_ERRN ccmkkernel::MkErrorC::getERRN ( const MkErrorC * clsHdl)
inlinestatic

(const) return LibMsgqueObject from current MkErrorC pointer

Definition at line 118 of file MkErrorC_cc.hh.

118 {
119 MK_ERRN ret = clsHdl ? reinterpret_cast<MK_ERRN>(clsHdl->hdl) : NULL;
120 if (unlikely(ret == NULL)) ClassHdlIsNullError(MkErrorC);
121 return ret;
122 };

◆ getERRN__null_allow() [1/3]

MK_ERRN ccmkkernel::MkErrorC::getERRN__null_allow ( ) const
inline

(const) return the LibMsgqueObject from current MkErrorC instance

Definition at line 101 of file MkErrorC_cc.hh.

101 {
102 return reinterpret_cast<MK_ERRN>(hdl);
103 };
+ Here is the caller graph for this function:

◆ getERRN__null_allow() [2/3]

static MK_ERRN ccmkkernel::MkErrorC::getERRN__null_allow ( const MkErrorC & clsHdl)
inlinestatic

(const) return LibMsgqueObject from current MkErrorC reference

Definition at line 145 of file MkErrorC_cc.hh.

145 {
146 return clsHdl.getERRN__null_allow();
147 };

◆ getERRN__null_allow() [3/3]

static MK_ERRN ccmkkernel::MkErrorC::getERRN__null_allow ( const MkErrorC * clsHdl)
inlinestatic

(const) return LibMsgqueObject from current MkErrorC pointer

Definition at line 125 of file MkErrorC_cc.hh.

125 {
126 return clsHdl ? reinterpret_cast<MK_ERRN>(clsHdl->hdl) : NULL;
127 };

◆ IsEXIT_DEFAULT()

static bool ccmkkernel::MkErrorC::IsEXIT_DEFAULT ( )
inlinestatic

Definition at line 181 of file MkErrorC_cc.hh.

181{return MkErrorIsEXIT (&MkERROR_NULL); }
bool MkErrorIsEXIT(MK_ERR const err)
check on APPLICATION-EXIT error …
#define MkERROR_NULL

◆ IsSOCKET_DEFAULT()

static bool ccmkkernel::MkErrorC::IsSOCKET_DEFAULT ( )
inlinestatic

Definition at line 182 of file MkErrorC_cc.hh.

182{return MkErrorIsSOCKET (&MkERROR_NULL); }
bool MkErrorIsSOCKET(MK_ERRN const err)
check on SOCKET-DOWN error …

◆ MkErrorC() [1/3]

ccmkkernel::MkErrorC::MkErrorC ( const MkErrorC & e)
inline

Definition at line 158 of file MkErrorC_cc.hh.

158 {
159 MkErrorC_Init(MkErrorDup_RT(MK_RT_CALL_NULL MkErrN(e.hdl)));
160 }
static MK_ERRN MkErrN(MK_MNGN mng)
(const) cast a unknown-object into an MkErrorS pointer or NULL if not possible
MK_ERR MkErrorDup_RT(MK_RT mkrt, MK_ERRN const srce)
Dup-Constructor - create a new MkErrorC instance as copy from an existing MkErrorC instance …
#define MK_RT_CALL_NULL

◆ MkErrorC() [2/3]

ccmkkernel::MkErrorC::MkErrorC ( const MkExceptionC & ex)
inline

Definition at line 161 of file MkErrorC_cc.hh.

161 {
162 MkErrorC_Init(MkErrorDup_RT(MK_RT_CALL_NULL MkErrN(ex.hdl)));
163 }

◆ MkErrorC() [3/3]

ccmkkernel::MkErrorC::MkErrorC ( MK_ERR hdl)
inline

Definition at line 73 of file MkErrorC_cc.hh.

◆ MkErrorC_ObjNew()

static MkErrorC * ccmkkernel::MkErrorC::MkErrorC_ObjNew ( MK_RT_ARGS MK_ERR hdl)
inlinestatic

return MkErrorC from LibMsgqueObject

Definition at line 77 of file MkErrorC_cc.hh.

77 {
78 return (hdl ? static_cast<MkErrorC*>(MkObjectC::atomObjNew(MK_RT_CALL MkErrorC_X2obj(hdl))) : &MK_NULL_REF);
79 }
static thread_local MkErrorC MK_NULL_REF
static MK_PTR atomObjNew(MK_RT_ARGS MK_OBJ obj)
+ Here is the caller graph for this function:

Variable Documentation

◆ MK_NULL_REF

thread_local MkErrorC ccmkkernel::MkErrorC::MK_NULL_REF = {(MK_OBJ)0}
static

Definition at line 34 of file MkErrorC_cc.hh.