Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
I can't get RETURN TO to work right.
Message
De
03/07/2002 14:38:42
 
 
À
03/07/2002 14:27:52
Information générale
Forum:
Visual FoxPro
Catégorie:
Classes - VCX
Divers
Thread ID:
00675050
Message ID:
00675058
Vues:
11
Nevermind. Solved it myself. I was putting the object name in cMethodToReturnTo. Needed just the method name.

>I'm using VFP7SP1.
>
>I'm finally starting to put code in my ERROR method for classes, instead of letting my global error handler just shut down the app.
>
>I can't get "Return to myMethod" to work.
>DEFINE CLASS cusPAYROLL as CUSTOM
>  cMethodToReturnTo = ''
>
>  PROCEDURE myMethod
>    THIS.cMethodToReturnTo = PROGRAM()
>    THIS.pck_Records()
>    RETURN THIS.lError
>  ENDPROC
>
>  PROCEDURE pck_Records()
>    ..... processing
>    ERROR 5                                   << works fine
>    ..... processing
>  ENDPROC
>
>  PROCEDURE ERROR()
>    LPARAMETERS nError, cMethod, nLine
>
>    LOCAL lcError, llJustLogError, lcReturn
>    WITH THIS
>      .lError = .T.
>      ***** determine which method the error occured in
>      DO CASE
>        CASE ATC( 'pck_Records', cMethod )>0
>          llJustLogError = .T.
>        CASE ATC( 'csCount', cMethod )>0
>          llJustLogError = .T.
>        OTHERWISE
>          ***** Unanticipated error occured
>          llJustLogError = .F.
>      ENDCASE
>      lcError = ON('Error')
>      IF llJustLogError
>        ***** triggers Errorhandler to RETURN rather than QUIT
>        lcError = lcError + [, .T.]
>      ENDIF
>      lcError = STRTRAN( lcError , 'PROGRAM()', ['] + .NAME + '.' + cMethod + ['] )
>      lcError = STRTRAN( lcError , 'LINENO()', TRANSFORM(nLine) )
>      lcError = STRTRAN( lcError , 'ERROR()', TRANSFORM(nError) )
>      &lcError
>      lcReturn = "RETURN TO " + .cMethodToReturnTo
>      &lcReturn
>    ENDWITH
>  ENDPROC
>ENDDEFINE
>
>&lcReturn
>In Real Time - crashes with "Syntax Error"
>In Debugger - ignored and returns to method where error occured and continues to process

>
>TIA
Bill Morris
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform