User Tools

Site Tools


takefatal_process_fatal_error_.htm
Navigation:  ABC Library Reference > ErrorClass > ErrorClass Methods >====== TakeFatal (process fatal error) C6H0009.jpg ====== Previous pageReturn to chapter overviewNext page

TakeFatal, PROTECTED, VIRTUAL, PROC

blk2blue.jpg

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

takefatal_process_fatal_error_.htm.txt · Last modified: 2021/04/15 15:57 by 127.0.0.1