# Appendix C: Function Error Responses

## Understanding Error Responses

Every function in CNS Menu returns a response indicating the success or failure of that function. If the function is successful, it will return a response indicating that it set the value you were trying to set, or completed the task that needed to be completed. If however, the function is not successful, it will return an Error Response. This Error Response is in the form of:

ERROR: <Function Name>: <Error Description>

For example, if you forgot to specify the FileName of the XML file you are trying to load with the CNSMenu_DefineMenuFile function, then that function will return the following Error Response:

ERROR: DefineMenuFile: You must specify a FileName.

Error responses always start with the word "ERROR" in all caps, followed by a colon, followed by the function that had the error, followed by a colon, followed by the actual error that occurred. You can use the various FileMaker Pro Text Functions to extract the different parts of the Error Response for your own use. For instance, if you want to know if the response you just got back was an ERROR, you can use the LeftWords function to return the first word and see if it is an error.

1. Set Field [Result, CNSMenu_DefineMenu( XML_Menu_Defs )]
2. If [LeftWords( Result ; 1 ) = "ERROR"]
3. <inform the user there was an error in the XML and exit>
4. End If