Error messages

How to turn off all error dialog messages, exceptions and so on, just make silent vcl app no matter how buggy is that
johnnyexAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

ArgentiCommented:
=))

make silent vcl app no matter how buggy is that

Imagine a Division by zero exception. What would you like your application to do in that case?

You can try this...
0
johnnyexAuthor Commented:
>Imagine a Division by zero exception. What would you like your application to do in that case?
should be quiet and imitate that nothing has happend like ob(ama).

Seriously want is that possible? Let's say app error dialogs, maybe not critical exceptions.
0
jimyXCommented:
Normally, disabling the error/warning notifications is not recommended, as it will invite wrong result to be accepted as correct if not noted, as well as blackout and leaving the client unaware of what is going on. Anyways, what you can do is either disabling all the exceptions from Delphi Project - Options, or suppressing the error messages when occurring in your code by enclosing your code blocks in Try-Except and have a Boolean Variable to check whether to notify the user or not in case you need to show the messages, which I prefer:

//Global var
var
  // whether to enable notifications or not
  enNotify:Boolean=False;    // False do not notify

procedure TForm1.Button1Click(Sender: TObject);
var
  x:extended;
  i,j :integer;
begin
  // generating division by zero error
  i := 5;
  j := 0;
  try
    x := i div j;
  except
    on E : Exception do
      begin
        if enNotify then
          begin
            showmessage('Err. Msg.: '+ e.Message);
          end;
      end;
  end;
end;

Open in new window

this way whenever you need to enable the notification you can just change the flag enNotify to True. Also you may give it as an option to the client to enable/disable by storing this flag in DB or registry, if required.
0
CompTIA Cloud+

The CompTIA Cloud+ Basic training course will teach you about cloud concepts and models, data storage, networking, and network infrastructure.

jimyXCommented:
Furthermore,
There are errors that can not (should not) be disabled, such as DB connections, HW transmission and alike status-based projects.
It all depends on your judgment.
0
Geert GOracle dbaCommented:
oh ...
you want to give someone a buggy application, but don't want them to see any errors  ?
or don't want anybody to see any errors ... you might want to log them

disabling them all is the first message ... with no code, now it shows the message
type
  TMainForm = class(TForm)
    procedure FormCreate(Sender: TObject);
  private
    procedure AppException(Sender: TObject; E: Exception);
  end;

procedure TMainForm.FormCreate(Sender: TObject);
begin
  Application.OnException := AppException;
end;
 
procedure TMainForm.AppException(Sender: TObject; E: Exception);
begin
  // Don't do anything ... who cares anyway ? 
end; 

Open in new window


btw ... the result for division by zero is not an exception: it's infinite
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
ArgentiCommented:
Congratulations Geert!
Btw, can you provide a way to use (not to handle!) infinite values in math operations in Delphi? Thx.
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Delphi

From novice to tech pro — start learning today.