Solved

handle my own exeption

Posted on 2004-08-10
3
217 Views
Last Modified: 2012-05-05
i created my own exeption in a function:
 myOwnException is inherited from class (EAbort);
 the command i wrote is: " raise myOwnException.Create('my exeption');"
my problem: i want to continue with the program after handeling the exeption when i
return to the mothers function.
0
Comment
Question by:mars_r
3 Comments
 
LVL 7

Expert Comment

by:sftweng
ID: 11761751
Doesn't
 
try
  {some code}
except
  {handle the exception}
end;
{more code}

work?
0
 
LVL 7

Accepted Solution

by:
LRHGuy earned 250 total points
ID: 11761761
You'll need to use a try..except block around the call to your function:


Try
   CallMyFunction
except
  {handle any exceptions}
end;
{program continues here}

If you want to handle only YOUR exception:

Try
  CallMyFunction
except
  on myownexception do
     Message('Oops!');
end;
0
 
LVL 12

Expert Comment

by:Ivanov_G
ID: 11762000
type
  myOwnException = class(Exception)

...

try

except
  on E: MyOwnException do
    begin
      ShowMessage(E.Message);
      Exit;
    end;
end;
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

A lot of questions regard threads in Delphi.   One of the more specific questions is how to show progress of the thread.   Updating a progressbar from inside a thread is a mistake. A solution to this would be to send a synchronized message to the…
Introduction Raise your hands if you were as upset with FireMonkey as I was when I discovered that there was no TListview.  I use TListView in almost all of my applications I've written, and I was not going to compromise by resorting to TStringGrid…
This video shows how to use Hyena, from SystemTools Software, to bulk import 100 user accounts from an external text file. View in 1080p for best video quality.
With Secure Portal Encryption, the recipient is sent a link to their email address directing them to the email laundry delivery page. From there, the recipient will be required to enter a user name and password to enter the page. Once the recipient …

685 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question