Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Can I have both TRY ENDTRY and the debugger?
Message
From
01/03/2008 13:21:21
 
 
To
All
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Title:
Can I have both TRY ENDTRY and the debugger?
Environment versions
Visual FoxPro:
VFP 9 SP1
Miscellaneous
Thread ID:
01297974
Message ID:
01297974
Views:
76
Hi,

Quite often, I write my procedure or method (especially one which does some processing) in the below format
lResult = .T.
TRY
   <some codes>

   If NOT <condition1>
      ERROR <cDesciptiopm of unfulfilled condition1> // which generate error 1098
   endif

   <some codes>
	
   If NOT <condition2>
      ERROR <cDesciptiopm of unfulfilled condition2>
   endif
        .
        .
        .
   <some codes>

   If NOT <condition N>
      ERROR <cDesciptiopm of unfulfilled condition N>
   endif
        .
        .
        .
CATCH TO oErr
   MESSAGEBOX(oErr.Message)
   lResult = .F.
ENDTRY
RETURN lResult
Even though I like to code in the above format... but I find it difficult to debug!
The problem is, all errors are channel to the CATCH block, be it error type 1098 that I intentionally trigger with the ERROR command or syntax error due to my typo/coding mistakes within the TRY ... ENDTRY structure... I wish to have syntax error handled in the original way -- a standard error message prompt followed by the popup of debbuger

I wonder if I could modify the CATCH block to get what I want
TRY
   .
   .
   .
CATCH TO oErr
   IF oErr.ERRORNO = 1098
      MESSAGEBOX(oErr.Message)
      lResult = .F.
   ELSE
      (Prompt error message like normal)
      (bring up the debbuger for the oErr)
   END
ENTRY
Is it possible to do the (Prompt error message like normal) and (bring up the debbuger for the oErr) as above?
If so, could anyone teach me how to code them?
Next
Reply
Map
View

Click here to load this message in the networking platform