Navigation: ABC Library Reference > ErrorClass > ErrorClass Methods >====== RemoveErrors (remove or restore recognized errors) ====== | |
RemoveErrors( error block )
RemoveErrors | Removes the entries specified in the error block from the Errors property. |
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 RemoveErrors method receives error entries and deletes them from the existing Errors property.
The Errors property may contain more than one error with the same ID. Errors added later override earlier added errors with the same IDs. If you remove an overriding error definition, the “overridden” error is fully restored.
Implementation:
RemoveErrors 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. However, RemoveErrors only considers the error ID when removing errors.
Example:
GlobalErrors ErrorClass !declare GlobalErrors object
Payroll PROCEDURE
PayErrors GROUP,STATIC
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
CODE
GlobalErrors.AddErrors(PayErrors) !add Payroll specific errors
!process payroll
GlobalErrors.RemoveErrors(PayErrors) !remove Payroll specific errors