Navigation: ABC Library Reference > ErrorClass > ErrorClass Methods >====== TakeFatal (process fatal error) ====== | |
TakeFatal, PROTECTED, VIRTUAL, PROC
The TakeFatal method is called when an error with Level:Fatal is “Thrown” to the ErrorClass (see Throw, ThrowFile, ThrowMessage).
TakeFatal must return a severity level (if the program is not HALTed).
Implementation:
The base class method (ErrorClass.TakeFatal) displays the error message and HALTs the program. Although this method does not actually return, the RETURN statement is required to avoid compile errors.
Return Data Type: BYTE
Example:
INCLUDE('ABERROR.INC') !declare ErrorClass
MyErrorClass CLASS(ErrorClass) !declare derived class
TakeFatal FUNCTION,BYTE,VIRTUAL !prototype corresponding virtual
END
GlobalErrors MyErrorClass !declare GlobalErrors object
CODE
GlobalErrors.Init !GlobalErrors initialization
!program code
GlobalErrors.Throw(Msg:CreateFailed) !Throw method calls SELF.TakeFatal to
!automatically call the derived class method
!rather than the base class method
!program code
MyErrorClass.TakeFatal FUNCTION !derived class virtual to handle fatal errors
CODE
!your custom code here
RETURN Level:Fatal
See Also: TakeError, Throw, ThrowFile, ThrowMessage