Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Stopping a function from my error handler...
Message
From
19/10/2000 14:43:35
 
 
To
19/10/2000 14:31:27
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
00431640
Message ID:
00431693
Views:
15
>>Hi,
>>
>>I'm trying to write an error handler function that'll stop a program that produced certain types of errors. I don't want my app to stop or exit, I only want to stop the execution of the function that caused the error after having displayed an error message. Here's how I wrote my function:
>>
>>
>>FUNCTION ErrorHandler(nError,cMethod,nLine)
>>LOCAL lcErrorMsg,lcCodeLineMsg
>>
>>   *Some code here
>>   IF nError = 13 THEN &&Table not opened
>>      *Code that sends a message and then stops the execution
>>      *of the calling method
>>   ENDIF
>>ENDFUNC
>>
>>
>>So, in this particular case, I want my function to stop whenever I can't open a table (because everything else is going to fail if the table is not opened properly).
>>
>>Thanks in advance, Stephane.
>
>What kind of error would you not want to cause your program to stop? The error is a sign that there is a problem, I would think you would rather it die sooner than later before more problems may occur. Unless you are throwing the error yourself (in code), it is unforeseen. How would you know what conditions you don't want to catch?

Well, for example, if a file is opened EXCLUSIVELY by a sysadmin for cleanup or for any other reasons and a user tries to write some info to it after hitting the OK button. I'd like for my program to say: "The file is currently being used, please try again later!" for example and return to the form being just opened skipping the rest of the code in the OK button.
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform