Navigation: ABC Library Reference > ErrorClass > ErrorClass Methods >====== AddErrors (add or override recognized errors) ====== | |
AddErrors( error block ), VIRTUAL
AddErrors | Adds entries to the Errors property from the error block passed to it. |
error block | A GROUP whose first component field is a USHORT containing the number of error entries in the GROUP. Subsequent component fields define the error entries. |
The AddErrors method receives error entries and adds them to the existing Errors property. These later added Error definitions “override” any earlier definitions with the same IDs. The “overridden” definitions are preserved for substitution into the %Previous macro symbol, and may be fully restored by removing the overriding error entries with the RemoveErrors method.
Implementation: AddErrors assumes the Errors property has already been created by Init or by some other method.
Each error block entry consists of a USHORT containing the error ID, a BYTE containing the severity level, a PSTRING containing the title to display on the error message window, and another PSTRING containing the error message text.
Example:
AppErrors GROUP
Number USHORT(2) !number of errors in the group
USHORT(Msg:RebuildKey) !first error ID
BYTE(Level:Notify) !severity level
PSTRING('Invalid Key') !window title
PSTRING('%File key is invalid.') !message text
USHORT(Msg:RebuildFailed) !second error ID
BYTE(Level:Fatal) !severity level
PSTRING('Key was not built') !window title
PSTRING('Repairing key for %File.')!message text
END
GlobalErrors ErrorClass !declare GlobalErrors object
CODE
GlobalErrors.Init !GlobalErrors initialization
GlobalErrors.AddErrors(AppErrors) !add some app specific errors
Main !call main procedure
GlobalErrors.Kill !GlobalErrors termination
See Also: Init, Errors, RemoveErrors