The question is: after am raising an exception, can I stop it to propagate from it's own constructor? consider the code bellow:
unit Unit2;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs;
type
TMyErrorClass = class(Exception)
constructor Create(aMsg:String);
end;
TForm2 = class(TForm)
procedure FormCreate(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form2: TForm2;
implementation
{$R *.dfm}
procedure TForm2.FormCreate(Sender: TObject);
begin
//
raise TMyErrorClass.Create('test');
end;
{ TMyErrorClass}
constructor TMyErrorClass.Create(aMsg: String);
begin
{$IFDEF DEBUG}
Showmessage(aMsg);
{$ELSE}
//here I want to 'kill' the exception
{$ENDIF}
end;
end.
After raise is called, how can I terminate the Exception, without adding try except/finally where I'm raising the exception?
LE: I have an app which has almost 2000 raise like this...and I'm trying to find out an alternative solution to write error handling for it....