[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

Exceptions

Posted on 2006-05-09
8
Medium Priority
?
166 Views
Last Modified: 2010-04-04
Hi

I need to block poping up error msg's when an exception is raised without blocking the app... sthing like an exception occurs but the doesn't do anything with, just goes further without glitches. How can i do that for every exception in a specific app ??

Thanks in advance
0
Comment
Question by:abrakadabra1
6 Comments
 
LVL 15

Accepted Solution

by:
mikelittlewood earned 172 total points
ID: 16643422
You can create your own exception handler to do nothing

procedure TForm1.ErrorHandler(Sender: TObject; E: Exception);
begin
  try
  except
    // do nothing
  end;
end;

On create of your application assign this as your exception handler

Application.OnException := ErrorHandler;

Dont forget while running via the IDE it will break on exception anyway, just not when running the compiled app
0
 

Author Comment

by:abrakadabra1
ID: 16643455
is there any way i can force a time out on TIdFTP while the proggy is running outside the IDE to check this handler ??
0
 
LVL 28

Assisted Solution

by:2266180
2266180 earned 164 total points
ID: 16643542
why not simply connect to a non existent host/ip?
0
VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

 
LVL 17

Assisted Solution

by:TheRealLoki
TheRealLoki earned 164 total points
ID: 16644248
you can also create a global exception handler.
Indy has an "OnException" event for many of it's components
I usually do not set this event, but handle it manually,
(example in indy 10)

uses IdStack, IdException;

If you want to handle it yourself you can do things like
try
    IdFtp1.Connect;
except
  on E: EIdSocketError do
  begin
      if pos('10054', E.Message) > 0 then //just an example
        statusbar1.simpletext := 'Indy 10054 error:' + e.message;
      else
       statusbar1.simpletext := 'Indy error: ' + e.message;
  end;
  on E: Exception do
     raise; // raise all other errors because they are probably critical
end;
0
 
LVL 4

Expert Comment

by:David_Ward
ID: 16647408
See Language Exceptions in DelphiHelp,

If the Exceptions that are casuing you problems at the moment are of a small number of particualr types, then you may be able to "ignore" them via configuration options.
0
 
LVL 28

Expert Comment

by:2266180
ID: 16647535
that is valid only for the IDE AFAIK :)
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

This article explains how to create forms/units independent of other forms/units object names in a delphi project. Have you ever created a form for user input in a Delphi project and then had the need to have that same form in a other Delphi proj…
In this tutorial I will show you how to use the Windows Speech API in Delphi. I will only cover basic functions such as text to speech and controlling the speed of the speech. SAPI Installation First you need to install the SAPI type library, th…
Is your data getting by on basic protection measures? In today’s climate of debilitating malware and ransomware—like WannaCry—that may not be enough. You need to establish more than basics, like a recovery plan that protects both data and endpoints.…
Whether it be Exchange Server Crash Issues, Dirty Shutdown Errors or Failed to mount error, Stellar Phoenix Mailbox Exchange Recovery has always got your back. With the help of its easy to understand user interface and 3 simple steps recovery proced…
Suggested Courses
Course of the Month18 days, 18 hours left to enroll

834 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