theKernel 10.0 NHI1 - theKernel - theLink - theConfig - theSq3Lite - theCompiler - theBrain - theGuard
c - tcl - py - rb - jv - cc
Loading...
Searching...
No Matches
MkErrorC_C_API

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

+ Collaboration diagram for MkErrorC_C_API:

Topics

 MkErrExtC
 MkErrExtS - extend the MkErrorC with a library specific feature …
 
 MkErrorPanicC
 signal-slot for panic on error
 
 MkErrorIgnoreC
 signal-slot for ignore on error
 
 MkErrorPrintC
 signal-slot for print on error
 
 MkErrorDefaultC
 signal-slot for raise an error
 
 MkErrorC_Class_C_API
 MkErrorC - define the class …
 
 MkErrorC_TOR_C_API
 MkErrorC - various functions to 'create' and 'delete' a MkErrorS
 
 MkErrorC_System_C_API
 MkErrorC - various functions to raise a 'System' messagen on MkErrorS
 
 MkErrorC_Signal_C_API
 MkErrorC - various functions to set and check a 'signal' on a MkErrorS
 
 MkErrorC_Get_C_API
 MkErrorC - various functions to 'get' data out of a MkErrorS
 
 MkErrorC_Raise_C_API
 MkErrorC - various functions to 'raise' a MkErrorS
 
 MkErrorC_Misc_C_API
 MkErrorC - various functions to 'work' on a MkErrorS
 

Classes

struct  libmkkernel::MkErrorS
 The data-type to store and handle the error-conditionMore...
 

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::Setup();
  // 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);
  }
  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