Solved

handle my own exeption

Posted on 2004-08-10
3
215 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

Ransomware-A Revenue Bonanza for Service Providers

Ransomware – malware that gets on your customers’ computers, encrypts their data, and extorts a hefty ransom for the decryption keys – is a surging new threat.  The purpose of this eBook is to educate the reader about ransomware attacks.

Question has a verified solution.

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

Suggested Solutions

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…
The uses clause is one of those things that just tends to grow and grow. Most of the time this is in the main form, as it's from this form that all others are called. If you have a big application (including many forms), the uses clause in the in…
Along with being a a promotional video for my three-day Annielytics Dashboard Seminor, this Micro Tutorial is an intro to Google Analytics API data.
Microsoft Active Directory, the widely used IT infrastructure, is known for its high risk of credential theft. The best way to test your Active Directory’s vulnerabilities to pass-the-ticket, pass-the-hash, privilege escalation, and malware attacks …

770 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