Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Try/Catch
Message
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Title:
Miscellaneous
Thread ID:
00802432
Message ID:
00802752
Views:
26
Garrett,
I understand your point, and I agree that try/catch is a Huge improvement over on error and I love the concept. To me, one of the best uses for try/catch is to help me put in low level error handling in places where there is none (just the global error handler). So comparing the size of 'on error' vs 'try/catch' programs is not what I am worried about. It is the comparison of a program with very little local error handling vs one with try/catch. At this point, I believe I want to use try/catch quite alot in my programs. However, what I perceive as program bloat is concern for me.
Though the following is not a truly 'fair' example, it is demonstrative of this point: I can do in 7 lines of code (making use of the 'useexcl' function that I wrote long ago) what might take 13 lines of code to do using try/catch. Now, if I could use a return in the catch statement, the code would be cleaner to read and take only 10 lines which would be much more to my liking.

Thanks very much for your reply,
Eddie Caldwell
Still waiting for the light to go on in my head =)
lopenok=(useexcl('table1') and useexcl('table2') and useexcl('table3'))
close all
if !lopenok
    messagebox('Unable to Get exclusive use of tables')
    return
    endif
do backups
or
try
    use table1 excl in 0
    use table2 excl in 0
    use table3 excl in 0
catch
    lerror=.t.
endtry
close all
if lerror=.t.
   messagebox('Unable to get exclusive use of tables')
   return
   endif
do backups
If Bill Gates had a penny for every time windows crashed he'd be... Oh wait he does!
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform