> Perhaps you are using the "On ExceptionName Do" and only checking for
> certain exceptions. In this case, if the exception is not one of the named
> exceptions, Delphi says that you have handled the exception [...]

This is false.

If the exception is not one of the named exceptions Delphi backtracks
through the call stack markers looking for a handler that DOES handle
that exception and if it doesn't find one, the application will have an
"unhandled" exception.   By default this gets passed to the application
handler.   By default that puts up an error dialog.

> [...] and will carry on with the code after the "end;" of the exception.

No.   It doesn't do that.

Here's an example to demonstrate what it does do.

-ns


unit Unit1;

interface

uses
  Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
  StdCtrls;

type
  TForm1 = class(TForm)
    Button1: TButton;
    Button2: TButton;
    procedure Button1Click(Sender: TObject);
    procedure Button2Click(Sender: TObject);
  private
    { Private declarations }
    procedure SomethingStupid;
    procedure SomethingDumb;
  public
    { Public declarations }
  end;

  MyException = class(Exception);

var
  Form1: TForm1;

implementation

{$R *.DFM}

procedure TForm1.SomethingStupid;
begin
  raise MyException.Create('foo');
end;

procedure TForm1.SomethingDumb;
begin
  raise Exception.Create('foo');
end;

procedure TForm1.Button1Click(Sender: TObject);
begin
  try
       SomethingStupid;
       ShowMessage('Got here');
  except on MyException do
    begin
       ShowMessage('Oops! MyException');
    end;
  end;
end;

procedure TForm1.Button2Click(Sender: TObject);
begin
  try
       SomethingDumb;
       ShowMessage('Got here');
  except on MyException do
    begin
       ShowMessage('Oops! MyException');
    end;
  end;
end;

end.




---------------------------------------------------------------------------
    New Zealand Delphi Users group - Delphi List - [EMAIL PROTECTED]
                  Website: http://www.delphi.org.nz
To UnSub, send email to: [EMAIL PROTECTED] 
with body of "unsubscribe delphi"

Reply via email to