User Tools

Site Tools


takeuser_process_user_error_.htm
Navigation:  ABC Library Reference > ErrorClass > ErrorClass Methods >====== TakeUser (process user error) C6H0009.jpg ====== Previous pageReturn to chapter overviewNext page

TakeUser, PROTECTED, VIRTUAL, PROC

blk2blue.jpg

The TakeUser method is called when an error with Level:User is “Thrown” to the ErrorClass (see Throw, ThrowFile, ThrowMessage).

TakeUser must return a severity level to denote the user's response.

Implementation:

The base class method (ErrorClass.TakeUser) displays the error message and returns either Level:Benign or Level:Cancel depending on the end user's response.

Return Data Type:     BYTE

Example:

 INCLUDE('ABERROR.INC')            !declare ErrorClass

MyErrorClass CLASS(ErrorClass)      !declare derived class

TakeUser      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.TakeUser to

                                  !automatically call the derived class method

                                  !rather than the base class method

 !program code

MyErrorClass.TakeUser FUNCTION     !derived class virtual to handle user errors

CODE

 !your custom code here

IF MESSAGE(SELF.SubsString(),SELF.GetErrorBufferTitle(),ICON:Question, |

  Button:Yes+Button:No,BUTTON:Yes,0) = Button:Yes

 !your custom code here

 RETURN Level:Benign

ELSE

 !your custom code here

 RETURN Level:Cancel

END

See Also:     TakeError, Throw, ThrowFile, ThrowMessage

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