Navigation: ABC Library Reference > ErrorClass > ErrorClass Methods >====== SetFatality (set severity level for a particular error) ====== | |
SetFatality( error id, severity )
SetFatality | Specifies the severity of a particular error in the Errors property. |
error id | An integer constant, variable, EQUATE, or expression that indicates which error definition to modify. |
severity | An integer constant, variable, EQUATE, or expression that indicates the severity of the error. |
The SetFatality method specifies the severity of a particular error in the Errors property. If there is more than one error with the same error id, only the last matching error in the list is affected.
Implementation:
The SetFatality method calls the SetId method to locate the specified error.
The ABERROR.INC file contains a list of default symbolic constants for the error id parameter. It also contains symbolic constants for the severity parameter. The severity EQUATEs and their default actions are:
Level:Benign | no action, returns Level:Benign | |
Level:User | displays message, returns Level:Benign or Level:Cancel | |
Level:Notify | displays message, returns Level:Benign | |
Level:Fatal | displays message, halts the program | |
Level:Program | treated as Level:Fatal | |
any other value | treated as Level:Program |
You may define your own additional severity levels and their associated actions.
Example:
GlobalErrors ErrorClass
CODE
GlobalErrors.Init
!change severity to fatal
GlobalErrors.SetFatality(Msg:CreateFailed,Level:Fatal)
CREATE(MyFile)
IF ERRORCODE()
GlobalErrors.SetFile('MyFile') !specify file that failed
GlobalErrors.Throw(Msg:CreateFailed) !issue fatal error message
END