Different Error Messages

The VerifyErrorBox function, shown below, illustrates how to solve the problem of different error messages on each GUI platform. For example, if a GUI platform always adds the prefix "Error:" to its message, while the other platforms do not, you might use or create a GUI Specifier for that platform and then use the VerifyErrorBox function as follows:

VerifyErrorBox (STRING sMsg)
   // verifies that the error box has the correct error
   // message, then dismisses the error box

   const ERROR_PREFIX = "ERROR: "
   const ERROR_PREFIX_LEN = Len (ERROR_PREFIX)
   STRING sActMsg = MessageBox.Message.GetText ()

   // strip prefix "ERROR: " from GUI Specifier for that platform error messages
   if (GetGUIType () == GUI Specifier for that platform)
      sActMsg = SubStr (sActMsg, ERROR_PREFIX_LEN + 1)

   Verify (sActMsg, sMsg)
   MessageBox.Accept ()