Error handling

From 360Works Product Documentation Wiki
Jump to: navigation, search
When something unexpected happens, the plug-in will pop up a dialog showing what the error message is. This makes it easy to see what went wrong. 
However, in some cases, you may prefer to show your own message to the user, or possibly not show a message at all. 
In that case, you can call <<setErrorCaptureFunctionName>> with a parameter of true. That will suppress the error dialog from appearing to the user.

When you call this function, it is set for that plug-in for as long as FileMaker is running, so if you want to do all of your own error handling, 
you can just set it to true once in your startup script. However, we recommend only turning it on when your script is prepared to check for errors, and then turning it off after finishing that section.



Whether or not you suppress the error dialogs, a plugin function will return the word ERROR if something goes wrong. It's a good idea to put your plugin functions in an 'If' statement so that you don't execute a bunch of script steps after something has gone wrong. If you'd like for your script to get the error message, you can get that by calling the <<lastErrorFunctionName>> function. 

Here is an example of basic error reporting: 




Set Variable [ $result: Value: MyPluginFunction("x" ; "y" ; "z") ]

If [ $result = "ERROR" ]
    
Show Custom Dialog [ "Error occurred: " & <<lastErrorFunctionName>> ]

Exit Script
Else
    
do more stuff here ...

End If





Chaining Multiple Functions Together

You can chain multiple dependent plugin operations together using the "and" operator. 
However, this is not something that we recommend. This reason for this is because if one of those plugin functions fail, the entire script step will fail but there is not telling which function actually failed which makes the issue difficult to diagnose. It is a much better approach to do error capturing as seen in the section above.

Additional Error Checking - Plugin not installed


 If a plugin is not installed correctly, calls to a plugin function will return "?". As part of your startup script, you should check for this occurrence and display a warning accordingly that the plugin needs to be installed. Note: when treated as a boolean true/false value, FileMaker will treat ? as true.

Personal tools
Namespaces

Variants
Actions
Plug-in Products
Other Products
Navigation
Toolbox