Topics   All   MacOS (Only)   Windows (Only)   Linux (Only, Not)   iOS (Only, Not)  
Components   Crossplatform Mac & Win   Server   Client   Old   Deprecated   Guides   Examples   Videos
New in version: 11.0   11.1   11.2   11.3   11.4   11.5   12.0   12.1   12.2   12.3    Statistic    FMM    Blog  

ErrorLog

Queries error log.

Component Version macOS Windows Linux Server iOS SDK License
Plugin 12.3 ✅ Yes ✅ Yes ✅ Yes ✅ Yes ✅ Yes Free
MBS( "ErrorLog" )

Parameters

none

Result

Returns JSON or error.

Description

Queries error log.
Error log gets activated with ClearErrors, which also clears all entries.
Please call ClearErrors function on beginning of a script and then on the end of the script, use HadErrors function to check if there was a problem. Use this function to query JSON with error details.

Querying the error log turns it off until the next call to ClearErrors function. You can add own entries with AddToErrorLog function.

Errors are tracked per thread, so on a server each PSoS session has its own error log. And it includes errors from subscripts.

Our error log is in addition to trace functions and Plugin.SetErrorScriptTrigger function.

Examples

Try the error log:

# test Errors in file Kontakte

# start error logging
Set Variable [ $r ; Value: MBS("ClearErrors") ]
#
# cause some errors
Set Variable [ $r ; Value: MBS("test"; 1; "Hello") ]
Set Variable [ $r ; Value: MBS("DynaPDF.Print"; 1; "Hello") ]
#
# now query error log
Set Variable [ $r ; Value: MBS("ErrorLog") ]
Show Custom Dialog [ "Error Log" ; $r ]

Example result:
[
  {
    "function":   "test",
    "result":   "[MBS] Unknown function: test",
    "parameter":   ["test", 1, "Hello"],
    "fileName":   "Kontakte",
    "scriptName":   "test Errors",
    "currentTimeStamp":   "23.06.2022 09:28:34"
  },
  {
    "function":   "DynaPDF.Print",
    "result":   "[MBS] DynaPDF.Print is only supported for Windows. Please use PDFKit.Print on Mac.",
    "parameter":   [
      "DynaPDF.Print",
      1,
      "Hello"
    ],
    "fileName":   "Kontakte",
    "scriptName":   "test Errors",
    "currentTimeStamp":   "23.06.2022 09:28:34"
  }
]

See also

Created 23th June 2022, last changed 23th June 2022


EnvironmentVariables.Value - EventMonitor.Clear

Feedback: Report problem or ask question.


Start Chat