Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

User Defined Exceptions...Exiting the Application

Status
Not open for further replies.

gharabed

Programmer
Sep 7, 2001
251
US
Another newbie question. I want to raise/throw an exception based on conditional logic within a sub and exit the application. How do I do this? Seems simple but I can't seem to find any examples that show how to do this. Do I use try, catch, throw? If so, how do I define and catch a user-defined exception? Also, once thrown in the sub, how to I continue to propogate it in the main?

Here is some pcode:

[tt]
Sub Main()
call MySub

<only do stuff if no exception was thrown in MySub>

End Sub

Sub MySub()
<stuff>
if myValue = <some error condition> then
<raise an error and exit the application>
end if
<do more stuff>
End Sub
[/tt]

Thanks,
Greg
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top