ReportError

(System Library)

Description: Post error information to VTS Trace and optionally, to the display.
Returns: Nothing
Usage: Script Only.
Function Groups: Error Manager
Related to:
Format:

System.ReportError(eMsg, QualifierSet[, UserAndSession, Silent, HelpFile, HelpID, TraceCategory, ApplicationGUID])

Parameters:  
eMsg
Required. Any text containing the error message.
QualifierSet

Required. An additional error data dictionary. This dictionary can accept any keys and values that can cast to strings. Each error generates a two-column table of information, built using this dictionary. The keys are displayed in the first column and the values are displayed in the second. Note that VTScada system code typically uses Setup.INI values to generate these strings so that they can be changed to suit different languages, but this is not a requirement.

UserAndSession
Optional. This parameter should capture the user responsible for the operation that lead to the error. This is required since users are linked to sessions that are only available to modules ultimately called by the Display Manager (that is, GUI objects). As a result, the "user and "session" often need to be captured earlier and passed to any modules likely to generate errors.
Silent
Optional Boolean. If TRUE, the error dialog will be suppressed. Defaults to the application property, ReportErrorSilenceAll, or FALSE if not otherwise set.
HelpFile
Optional text. If the dialog is to have a help button, and you are using a custom help file, provide its name here. May be left blank if you are using the VTScada help file.
HelpID
Optional numeric. If the dialog is to have a help button, provide the ID value from the help file's Alias file to link to the correct topic.
TraceCategory
Optional. The category to use in the VTScada Trace program.
ApplicationGUID
Optional text. Defaults to the current application's GUID. In the rare case where there can be ambiguity over which application caused the error, a GUID may be supplied for the source application.
Comments:

If this function displays the error message to the operator, it will use the newer format, which was introduced in VTS 10.0. This format enables you to display multiple error messages in one screen, each with its own Help ID value.

The error will be recorded in the Error Log file at the VTScada level, as well as being stored for use by the TraceViewer. The log file ("errors.log") records every error that is raised via ReportError.

Examples:

IfThen(PickValid(!Bit(VarAttributes(FindVariable(VarName, TagMod, 0, 0)), 8 {Temporary}), FALSE),
{ A non-temporary variable of a disallowed name was present.  Produce an error. }
  ErrorInfo = Dictionary();
  ErrorInfo[\System\GetPhraseForLang("TypeNameLabel", \System\ErrorLang)] = Cast(TagMod, \#VTypeText);
  ErrorInfo[\System\GetPhraseForLang("VariableNameLabel", \System\ErrorLang)]        = VarName;
  ErrorInfo[\System\GetPhraseForLang("IncompatibleVersionLabel", \System\ErrorLang)] = Ver;
  ReportError(\System\GetPhraseForLang("BadTagVariableErr", \System\ErrorLang), ErrorInfo, Invalid, 0, DlgHelpFile, 12009 { HelpID 12009 });
);

|