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:
12.2
12.3
12.4
12.5
13.0
13.1
13.2
13.3
13.4
13.5
Statistic
FMM
Blog
Adds log entry to current error log.
Component | Version | macOS | Windows | Linux | Server | iOS SDK |
Plugin | 12.3 | ✅ Yes | ✅ Yes | ✅ Yes | ✅ Yes | ✅ Yes |
Parameter | Description | Example |
---|---|---|
JSON | The error as JSON. | "{\"error\": \"Test\"}" |
Returns OK or error.
Sample custom function to add FileMaker error to our Error Log:
Let([
e = Get(LastError);
d = Get(LastExternalErrorDetail);
r = MBS("AddToErrorLog";
JSONSetElement ( "{}" ;
[ "lastError" ; e; JSONNumber ] ;
[ "lastErrorMessage" ; d; JSONString ] ;
[ "scriptName" ; Get(ScriptName); JSONString ];
[ "fileName" ; Get(FileName); JSONString ];
[ "currentTimeStamp" ; Get(CurrentTimestamp); JSONString ]
))
]; e ≠ 0)
Catch various errors in MBS Plugin and in FileMaker:
Set Error Capture [ On ]
#
# start error logging
Set Variable [ $r ; Value: MBS("ClearErrors") ]
#
Loop
#
# cause some errors
Set Variable [ $r ; Value: MBS("test"; 1; "Hello") ]
Exit Loop If [ MBS("IsError") ]
#
Set Variable [ $r ; Value: MBS("DynaPDF.Print"; 1; "Hello") ]
Exit Loop If [ MBS("IsError") ]
#
# FileMaker error
Perform Script [ Specified: From list ; <unknown> ; Parameter: ]
Exit Loop If [ CheckError ]
#
# here we are done and no error happend
Exit Script [ Text Result: "Success" ]
End Loop
#
# now query error log
Set Variable [ $r ; Value: MBS("ErrorLog") ]
# and notice developer
Show Custom Dialog [ "Error Log" ; $r ]
This function is free to use.
Created 23th June 2022, last changed 17th July 2022