none
Try ... Catch RRS feed

  • Question

  • Hello All ,

     

    We are a software company having a product developed for Fincancial Systems in Visual Foxpro. The product is well settled and is running successfully for past 10-12 years. Now we are trying to trap our system errors by using Try... Catch ... and Finally instead of onerror .... But unfortunately we found that Try... and Catch can be used with in the method or procedure , it cannot be used throughout the project as how we use onerror().

     

    I just wanted a help from you if you have any solution on this.

     

    Thanks & Regards

    Mayuresh

     

    Eg. with Description

    ~~~~~~~~~~~~~~~~

    We are having a prg called main.prg where in we have called some otherr procedures functions, have created class objects also menu file and finally the main login form.

     

    We just tried to trap the error by forcefully entering wrong command in one of the forms , but it gave foxpro error instead of the error message box which we had given in the catch procedure.

     

     

    Wednesday, March 28, 2007 1:15 PM

Answers

  • The first thing is that TRY..CATCH is NOT a replacement for ON ERROR

     

    The objective of TRY...CATCH is to provide localized (often referred to as "exception" handling. You absolutely should NOT try and use TRY...CATCH instead of an error handler, it's purpose is to provide a means of handling exceptions in code that do not need to go to an error handler.

    Wednesday, March 28, 2007 2:06 PM

All replies

  • The first thing is that TRY..CATCH is NOT a replacement for ON ERROR

     

    The objective of TRY...CATCH is to provide localized (often referred to as "exception" handling. You absolutely should NOT try and use TRY...CATCH instead of an error handler, it's purpose is to provide a means of handling exceptions in code that do not need to go to an error handler.

    Wednesday, March 28, 2007 2:06 PM
  • Hello,

     

    Thanks for the solution ... you added a weightage to my suggestion ... thanks again.

     

    Rgds-

    Mayuresh

     

    Thursday, March 29, 2007 8:19 AM