General information
Title:
Exception Handling and Stored Procedures
In a database I have several stored procedures that raise errors that can be handled using a maintenance form class. These errors are caused by the user entering invalid data, and I want to display these errors in a different manner than other errors. My maintenance form parses the error, and checks for certain error codes, like a table rule failure. If it doesn't match the specified error codes, my regular error handling is invoked. This technique has worked well for me in my VFP 6 apps, but I am developing my latest application in 8.
My problem is this: if I use a try block to wrap a tableupdate() or some other command that causes the buffer to be written to disk (firing a stored procedure), I get a "procedure canceled" dialog box when I raise an error. I tried using throw instead of error, but I still get the same dialog box. I know this has to do with the try block, because a few areas of my application do not use exception handling, and I do not get the dialog. I've tried looking in the help docs and online, but I can't find how to suppress this dialog. I don’t want to forgo using exception handling, because I’ve found it to be very useful in certain situations. I’ve tried setting talk off, but that doesn’t seem to help. I’m guessing I see this dialog because the procedure has been “canceled”, meanding that anything after the error command is not going to run. What I don’t understand is why this would happen for stored procedures vs. prg and method calls, because raising an error or throwing an exception effectively cancels that code as well, yet you don’t get the dialog.
Any ideas?
Next
Reply
View the map of this thread
View the map of this thread starting from this message only
View all messages of this thread
View all messages of this thread starting from this message only