theKernel 10.0
Loading...
Searching...
No Matches
csmkkernel.MkErrorC Class Reference

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

+ Inheritance diagram for csmkkernel.MkErrorC:
+ Collaboration diagram for csmkkernel.MkErrorC:

Public Member Functions

new MkErrorC Next ()
  C#: MkErrorC err.Next() C-API
get next instance from linked-list of MkErrorS type
 
new MkErrorC Prev ()
  C#: MkErrorC err.Prev() C-API
get previous instance from linked-list of MkErrorS type
 
MkErrorE GetCode ()
  C#: MkErrorE err.GetCode() C-API
get the value of MkErrorS::code
 
int GetNum ()
  C#: int err.GetNum() C-API
get the MkErrorS::num. The number can be used as exit-code …
 
long GetSize ()
  C#: long err.GetSize() C-API
get the error-message-size from the exception-object
 
string GetText ()
  C#: string err.GetText() C-API
get the MkErrorS::text
 
MkErrorC Catch (Exception exception=null, [CallerMemberName]string callfunc=null)
  C#: MkErrorC err.Catch(Exception exception = null, [CallerMemberName]string callfunc = null) C-API
convert a programming-language-error into an csmkkernel error …
 
void Cleanup ([CallerMemberName]string callfunc=null, [CallerLineNumber]int callline=-1)
  C#: err.Cleanup([CallerMemberName]string callfunc = null, [CallerLineNumber]int callline = -1) C-API
cleanup and print unwanted active error …
 
void Println (string msg="", [CallerMemberName]string callfunc=null, [CallerLineNumber]int callline=-1)
  C#: err.Println(string msg = "", [CallerMemberName]string callfunc = null, [CallerLineNumber]int callline = -1) C-API
print the default-error to the MkLogFileC (default: stderr) and clear the error afterwards …
 
void Reset ([CallerMemberName]string callfunc=null, [CallerLineNumber]int callline=-1, bool force=false)
  C#: err.Reset([CallerMemberName]string callfunc = null, [CallerLineNumber]int callline = -1, bool force = false) C-API
This function clears the err and resets to MK_OK
 
MkErrorE Stack ([CallerMemberName]string callfunc=null, [CallerFilePath]string callfile=null, [CallerLineNumber]int callline=-1)
  C#: MkErrorE err.Stack([CallerMemberName]string callfunc = null, [CallerFilePath]string callfile = null, [CallerLineNumber]int callline = -1) C-API
check on error and if yes append an ErrorStackFormat to the error-message
 
void StackFormat ([CallerMemberName]string callfunc=null, [CallerFilePath]string callfile=null, [CallerLineNumber]int callline=-1)
  C#: err.StackFormat([CallerMemberName]string callfunc = null, [CallerFilePath]string callfile = null, [CallerLineNumber]int callline = -1) C-API
append an ensemble of func, file and line to the error-message
 
MkErrorC NoRaise ()
  C#: MkErrorC err.NoRaise() C-API
ignore the next return of MK_ERROR and do not raise an target-language-exception
 
void AppendC (string message)
  C#: err.AppendC(string message) C-API
append the message to the MkErrorS::text
 
void Raise ()
  C#: err.Raise() C-API
convert an csmkkernel error into an programming-language-error and raise afterwards. …
 
void SetC (string message, [CallerMemberName]string callfunc=null, int errnum=-1)
  C#: err.SetC(string message, [CallerMemberName]string callfunc = null, int errnum = -1) C-API
'set' and 'raise' the MkErrorC using a string-message and a errnum-number
 
bool IsABORT ()
  C#: bool err.IsABORT() C-API
check on ABORT signal …
 
bool IsEXIT ()
  C#: bool err.IsEXIT() C-API
check on APPLICATION-EXIT error …
 
bool IsSOCKET ()
  C#: bool err.IsSOCKET() C-API
check on SOCKET-DOWN error …
 
bool IsTIMEOUT ()
  C#: bool err.IsTIMEOUT() C-API
check on TIMEOUT error …
 
void SetABORT (string detail="UNKNOWN", [CallerMemberName]string callfunc=null)
  C#: err.SetABORT(string detail = "UNKNOWN", [CallerMemberName]string callfunc = null) C-API
send the ABORT signal to the calling stack…
 
void SetCONTINUE ()
  C#: err.SetCONTINUE() C-API
signal end of processing in an MqMqEventIF callback …
 
void SetCode (MkErrorE code)
  C#: err.SetCode(MkErrorE code) C-API
set the MkErrorS::code value …
 
void SetEXIT ([CallerMemberName]string callfunc=null)
  C#: err.SetEXIT([CallerMemberName]string callfunc = null) C-API
finish the current callback, return to toplevel and MqExit the application …
 
void SetSOCKET (string detail="UNKNOWN", [CallerMemberName]string callfunc=null)
  C#: err.SetSOCKET(string detail = "UNKNOWN", [CallerMemberName]string callfunc = null) C-API
create SOCKET-DOWN error …
 
MkErrorC Dup ()
  C#: [constructor] MkErrorC srce.Dup() C-API
Dup-Constructor - create a new MkErrorC instance as copy from an existing MkErrorC instance …
 
void Copy (MkErrorC srce)
  C#: dest.Copy(MkErrorC srce) C-API
Copy-Constructor - sync an existing MkErrorC instance with the values from an existing MkErrorC instance …
 
- Public Member Functions inherited from csmkkernel.MkObjectC
delegate void MkObjectDeleteSCB (string typeName, int typeHdl, int objHdl)
 implements the csmkkernel API object: public version from MkObjectDeleteSCB as method
 
void ErrorCheck (MkErrorE err)
 
bool Check ()
 
string ToNameOfClass ()
  C#: string obj.ToNameOfClass() C-API
Class-Slot - returns the C#-Class-Name of the obj as string
 
void HandleDelete ()
  C#: netObj.HandleDelete() C-API
Handle-Delete-Slot - delete a netObj from handle-storage …
 
bool HandleExists ()
  C#: bool obj.HandleExists() C-API
check if obj has already a handle defined…
 
Int32 HandleGet ()
  C#: Int32 obj.HandleGet() C-API
Handle-Get-Slot - returns a export-hdl to the MkObjectC useable for external storage
 
Int32 HandleGetOfType ()
  C#: Int32 obj.HandleGetOfType() C-API
Export-Slot - returns typeHdl of the obj .
 
Int32 HandleGetOr0 ()
  C#: Int32 obj.HandleGetOr0() C-API
return export-hdl or 0 in not created…
 
MkObjectC Next ()
  C#: MkObjectC obj.Next() C-API
get next instance from linked-list of MkObjectS type
 
MkObjectC Prev ()
  C#: MkObjectC obj.Prev() C-API
get previous instance from linked-list of MkObjectS type
 
void DbgDump (string message="var", [CallerMemberName]string callfunc=null)
  C#: obj.DbgDump(string message = "var", [CallerMemberName]string callfunc = null) C-API
debug: Dump a instance to stderr with LNG and MQ internal data…
 
void DbgL (string message, int debug=0, [CallerMemberName]string callfunc=null, int lvl=0)
  C#: fmtobj.DbgL(string message, int debug = 0, [CallerMemberName]string callfunc = null, int lvl = 0) C-API
debug: write a instance-marker to the MkLogFileC (default: stderr) using the fmtobj as prefix …
 
void DbgLogC ([CallerMemberName]string callfunc=null)
  C#: obj.DbgLogC([CallerMemberName]string callfunc = null) C-API
debug: write a short-obj-summary to MkLogFileC (default: stderr) …
 
void DbgO ([CallerMemberName]string callfunc=null)
  C#: obj.DbgO([CallerMemberName]string callfunc = null) C-API
debug: write the object-details to MkLogFileC (default: stderr) …
 
void DbgSTACK (int skip=0, int num=-1, [CallerMemberName]string callfunc=null)
  C#: fmtobj.DbgSTACK(int skip = 0, int num = -1, [CallerMemberName]string callfunc = null) C-API
debug: write the stack-trace to MkLogFileC (default: stderr) …
 
void LogC (string message, int debug=0, [CallerMemberName]string callfunc=null)
  C#: fmtobj.LogC(string message, int debug = 0, [CallerMemberName]string callfunc = null) C-API
write a logging-message to MkLogFileC (default: stderr) using the internal format …
 
void LogHEX (string callfunc, byte[] data)
  C#: fmtobj.LogHEX(string callfunc, byte[] data) C-API
log binaray data as HEX into the MkLogFileC (default: stderr) …
 
void Log (MkObjectC fmtobj=null, int debug=0, [CallerMemberName]string callfunc=null, int lvl=0)
  C#: obj.Log(MkObjectC fmtobj = null, int debug = 0, [CallerMemberName]string callfunc = null, int lvl = 0) C-API
Log-Slot - log a summary of an object to the MkLogFileC (default: stderr) target …
 
void LogLong (MkObjectC fmtobj=null, int debug=0, [CallerMemberName]string callfunc=null, int lvl=0)
  C#: obj.LogLong(MkObjectC fmtobj = null, int debug = 0, [CallerMemberName]string callfunc = null, int lvl = 0) C-API
log the MkObjectS verbose into the MkLogFileC (default: stderr) …
 
void LogShort (MkObjectC fmtobj=null, int debug=0, [CallerMemberName]string callfunc=null, int lvl=0)
  C#: obj.LogShort(MkObjectC fmtobj = null, int debug = 0, [CallerMemberName]string callfunc = null, int lvl = 0) C-API
log the MkObjectS into the MkLogFileC (default: stderr) …
 
void LogType (MkObjectC fmtobj=null, int debug=0, [CallerMemberName]string callfunc=null, int lvl=0)
  C#: obj.LogType(MkObjectC fmtobj = null, int debug = 0, [CallerMemberName]string callfunc = null, int lvl = 0) C-API
log the tyoe of the MkObjectS into the MkLogFileC (default: stderr) …
 
MkErrorC ErrorCatch (Exception exception=null, [CallerMemberName]string callfunc=null)
  C#: MkErrorC obj.ErrorCatch(Exception exception = null, [CallerMemberName]string callfunc = null) C-API
convert a programming-language-error into an csmkkernel error …
 
MkErrorC ToError ()
  C#: MkErrorC obj.ToError() C-API
Error-Slot - return an error-object pre initialized with obj data.
 
bool IsNull ()
  C#: bool obj.IsNull() C-API
ckeck if the object is null
 
string ToName ()
  C#: string obj.ToName() C-API
Info-Slot - returns brief information about the obj as a string
 
string ToNameOfType ()
  C#: string obj.ToNameOfType() C-API
Type-Slot - returns the LibMkKernel-Type-Name of the obj as a string
 
override string ToString ()
  C#: string inst.ToString() C-API
String-Slot - returns the string representation of the inst
 
int RefGet ()
 MkRefGetP
 
void SysKill (int pid, int signal)
 MkSysKill
 
int SysGetPid ()
 MkSysGetPid
 
void Dispose ()
  C#: [destructor] obj.Dispose() C-API
Dispose-Slot - untie the connection between the Native-C#-Instance and the csmkkernel-Instance.
 
void Delete ()
  C#: [destructor] obj.Delete() C-API
Delete-Slot - delete an instance.
 

Static Public Member Functions

static MkErrorC MkErrorC_ObjNew (IntPtr hdl)
 
static void Check (IntPtr ctx, MkErrorE err)
 
static void Check (MkErrorE err)
 
static MkErrorE Stack (IntPtr mkrt, IntPtr hdl, [CallerMemberName]string callfunc=null, [CallerFilePath]string callfile=null, [CallerLineNumber]int callline=-1)
  C#: MkErrorE err.Stack([CallerMemberName]string callfunc = null, [CallerFilePath]string callfile = null, [CallerLineNumber]int callline = -1) C-API
check on error and if yes append an ErrorStackFormat to the error-message
 
static MkErrorE StackFull (IntPtr mkrt, IntPtr hdl)
  C#: MkErrorE err.Stack([CallerMemberName]string callfunc = null, [CallerFilePath]string callfile = null, [CallerLineNumber]int callline = -1) C-API
check on error and if yes append an ErrorStackFormat to the error-message
 
new static MkErrorC HandleResolve (Int32 netHdl)
  C#: [static] MkErrorC MkErrorC.HandleResolve(Int32 netHdl) C-API
Handle-Resolve-Slot - return a MkErrorC from netHdl or null if invalid…
 
new static MkErrorC Instances ()
  C#: [static] MkErrorC MkErrorC.Instances() C-API
get head-instance from linked-list of MkErrorS type …
 
new static MkErrorC GetNull ()
  C#: [static] MkErrorC MkErrorC.GetNull() C-API
Null-Slot - return a MkErrorC typed NULL instance …
 
static void PanicC (MkObjectC fmtobj, string callfunc, int errnum, string message)
  C#: [static] MkErrorC.PanicC(MkObjectC fmtobj, string callfunc, int errnum, string message) C-API
do a panic with string as argument …
 
static void PanicDEFAULT (MkObjectC fmtobj=null, [CallerMemberName]string callfunc=null)
  C#: [static] MkErrorC.PanicDEFAULT(MkObjectC fmtobj = null, [CallerMemberName]string callfunc = null) C-API
make panic from MkErrorDEFAULT_RT …
 
static MkErrorC DEFAULT ()
  C#: [static] MkErrorC MkErrorC.DEFAULT() C-API
default-system-error - default-error
 
static MkErrorC FORMAT (MkObjectC fmtobj=null)
  C#: [static] MkErrorC MkErrorC.FORMAT(MkObjectC fmtobj = null) C-API
system-error-format - format and return the default-error
 
static MkErrorC IGNORE ()
  C#: [static] MkErrorC MkErrorC.IGNORE() C-API
ignore-system-error - ignore the next error …
 
static MkErrorC PRINT ()
  C#: [static] MkErrorC MkErrorC.PRINT() C-API
ignore-system-error - print the next error into MkLogFileC
 
- Static Public Member Functions inherited from csmkkernel.MkObjectC
static MkObjectC MkObjectC_ObjNew (IntPtr hdl)
 
static IntPtr getOBJ (string cls, MkObjectC obj)
 
static IntPtr getOBJ_null_allow (MkObjectC obj)
 
static MkObjectC HandleResolve (Int32 netHdl)
  C#: [static] MkObjectC MkObjectC.HandleResolve(Int32 netHdl) C-API
Handle-Resolve-Slot - return a MkObjectC from netHdl or null if invalid…
 
static void HandleDeleteByNetHdl (Int32 netHdl)
  C#: [static] MkObjectC.HandleDeleteByNetHdl(Int32 netHdl) C-API
Handle-Delete-Slot - delete a netHdl from handle-storage …
 
static MkObjectC Instances ()
  C#: [static] MkObjectC MkObjectC.Instances() C-API
get head-instance from linked-list of MkObjectS type …
 
static MkObjectC GetNull ()
  C#: [static] MkObjectC MkObjectC.GetNull() C-API
Null-Slot - return a MkObjectC typed NULL instance …
 
static void DbgM (string message, int debug=0, [CallerMemberName]string callfunc=null, int lvl=0)
  C#: [static] MkObjectC.DbgM(string message, int debug = 0, [CallerMemberName]string callfunc = null, int lvl = 0) C-API
debug: write a static-marker to the MkLogFileC (default: stderr) …
 
static int SysHashI32 (string key, int length=-1)
 MkSysHashI32
 
static string SysHashSTR (string key, int length=-1)
 MkSysHashSTR
 
static void DeleteCallbackCleanup (string ident)
  C#: [static] MkObjectC.DeleteCallbackCleanup(string ident) C-API
cleanup the DeleteCallback installed with MkObjectDeleteCallbackSetup
 
static void DeleteCallbackSetup (string ident, MkObjectDeleteSCB callback=null, string filter=null)
  C#: [static] MkObjectC.DeleteCallbackSetup(string ident, MkObjectDeleteSCB callback = null, string filter = null) C-API
Create/Delete the instance-delete-callback
 
static int getPId ()
 
static int getTId ()
 
static string getStackTrace (int level=2)
 
static string getCallerProc (int level=2)
 
static int getCallerLine (int level=2)
 
static string getCallerFile (int level=2)
 

Additional Inherited Members

- Protected Member Functions inherited from csmkkernel.MkObjectC
 MkObjectC (IntPtr obj)
 
 MkObjectC ()
 
virtual void Dispose (bool disposing)
 Support IDisposable.
 
- Static Protected Member Functions inherited from csmkkernel.MkObjectC
static object atomObjNew (Type type, ConstructorInfo ctor, IntPtr obj)
 
static object atomObjCreate (Type type, ConstructorInfo ctor, IntPtr obj)
 
static IntPtr atomSelfCreate (ConstructorInfo ctor, IntPtr obj, IntPtr env)
 
static object atomSelfNull (ConstructorInfo ctor)
 
static void atomSelfUnlink (IntPtr self, IntPtr env)
 
static ConstructorInfo getCtor (Type type)
 
static string Name (IntPtr mkrt, IntPtr obj)
  C#: string obj.ToName() C-API
Info-Slot - returns brief information about the obj as a string
 
- Protected Attributes inherited from csmkkernel.MkObjectC
IntPtr pmkrt = IntPtr.Zero
 
- Package Functions inherited from csmkkernel.MkObjectC
- Static Package Functions inherited from csmkkernel.MkObjectC
- Properties inherited from csmkkernel.MkObjectC
IntPtr hdl [get, set]
 
IntPtr hdl_null_allow [get, set]
 
IntPtr mkrt [get, set]
 

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 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 csmkkernel into the error-handling-code of the target C#.

Example from Filter6.cs use MqContextErrorCatch to convert a C# error into a csmkkernel error

    public static void Main(string[] argv) {
      Filter6 srv = MqFactoryCT<Filter6>.Add().New();
      try {
	srv.LinkCreate(argv);
	srv.ProcessEvent(MqWaitOnEventE.FOREVER);
      } catch (Exception ex) {
        srv.ErrorCatch (ex);
      }
      srv.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 default-error is defined in MkRuntimeS::error_mk.
  • On error the default-error is set to the error-data, the MkErrorE status change to MK_ERROR.
  • The non-C language create a copy from the default-error and throw the copy as MkExceptionC exception.
  • The C language just return the MkErrorE status of the default-error.

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

          var VAL = ReadBUF();
          mycl = new Client();
          mycl.LinkCreate(ConfigGetStartAs());
          var PID = (int) mycl.Send("W", "GPID@I");
          int RET=0;
          SysKill(PID,9);
          for (int i = 0; i < 3; i++) {
            try {
              RET = (int) mycl.Send("W", "ECOI:U@I", VAL);
            } catch (MkExceptionC ex) {
              var err = mycl.ErrorCatch(ex);
              if (err.IsSOCKET()) {
                err.Reset();
                mycl.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 null the global exception object is used

Definition at line 498 of file MkErrorC.cs.

Member Function Documentation

◆ Check() [1/2]

static void csmkkernel.MkErrorC.Check ( IntPtr ctx,
MkErrorE err )
inlinestatic

Definition at line 74 of file MkErrorC.cs.

74 {
75 if (err <= MkErrorE.CONTINUE) return;
76 // null allowed == MK_ERROR_DEFAULT
77 throw new MkExceptionC( ctx );
78 }
MkErrorE
collection for the different error-codes …

◆ Check() [2/2]

static void csmkkernel.MkErrorC.Check ( MkErrorE err)
inlinestatic

Definition at line 80 of file MkErrorC.cs.

80 {
81 Check(IntPtr.Zero,err);
82 }

◆ MkErrorC_ObjNew()

static MkErrorC csmkkernel.MkErrorC.MkErrorC_ObjNew ( IntPtr hdl)
inlinestatic

Definition at line 38 of file MkErrorC.cs.

38 {
39 return hdl != IntPtr.Zero ? (MkErrorC) atomObjNew(typeof(MkErrorC), ctor, hdl) : MK_NULL.Value;
40 }
static object atomObjNew(Type type, ConstructorInfo ctor, IntPtr obj)
Definition MkObjectC.cs:189
+ Here is the caller graph for this function:

◆ Stack()

static MkErrorE csmkkernel.MkErrorC.Stack ( IntPtr mkrt,
IntPtr hdl,
[CallerMemberName] string callfunc = null,
[CallerFilePath] string callfile = null,
[CallerLineNumber] int callline = -1 )
inlinestatic

C#: MkErrorE err.Stack([CallerMemberName]string callfunc = null, [CallerFilePath]string callfile = null, [CallerLineNumber]int callline = -1) C-API
check on error and if yes append an ErrorStackFormat to the error-message

Definition at line 85 of file MkErrorC.cs.

91 {
92 IntPtr callfunc_cstr = Marshal.StringToHGlobalAnsi(callfunc);
93 IntPtr callfile_cstr = Marshal.StringToHGlobalAnsi(callfile);
94 var ret = Mk.MkErrorStack(mkrt,Mk.MkErrorFORMAT(hdl), callfunc_cstr, callfile_cstr, callline);
95 Marshal.FreeHGlobal(callfile_cstr);
96 Marshal.FreeHGlobal(callfunc_cstr);
97 return ret;
98 }
csmkkernel.MkKernel Mk
+ Here is the caller graph for this function:

◆ StackFull()

static MkErrorE csmkkernel.MkErrorC.StackFull ( IntPtr mkrt,
IntPtr hdl )
inlinestatic

C#: MkErrorE err.Stack([CallerMemberName]string callfunc = null, [CallerFilePath]string callfile = null, [CallerLineNumber]int callline = -1) C-API
check on error and if yes append an ErrorStackFormat to the error-message

Definition at line 101 of file MkErrorC.cs.

104 {
105 var err = Mk.MkErrorFORMAT(hdl);
106 var code = Mk.MkErrorGetCode(err);
107 if (code <= MkErrorE.CONTINUE) return code;
108
109 StackTrace st = new System.Diagnostics.StackTrace(1, true);
110
111 foreach (var sf in st.GetFrames())
112 {
113 var meth = sf.GetMethod();
114 if (meth.Name == "ServiceCall") break;
115 string fn;
116 int ln;
117 if (StackFrameExtensions.HasSource(sf)) {
118 fn = sf.GetFileName();
119 ln = sf.GetFileLineNumber();
120 } else {
121 fn = meth.DeclaringType.Module.Name;
122 ln = -1;
123 }
124 MkErrorC.Stack(mkrt,err,meth.ToString(), fn, ln);
125 }
126 return code;
127 }
+ Here is the caller graph for this function:

The documentation for this class was generated from the following file: