In fact, we use many exception classes in our code to detect special conditions. The exceptions are handled in an OnException handler. Sometimes the handling just displays a message to the user.
In our code, we heavily use the exceptions mechanism and they don't indicate bugs. We would like to be able to list the exception classes for which madexcept should create a report, there are not that many. From your website, it seems that you consider almost all exceptions as ''errors'' and you provide a mechanism to filter ''out'' some exception classes. We have exactly the opposite situation: most exceptions are just part of the ''normal'' logic of the application and we just need a mechanism to filter ''in'' just a few cases that indeed reflect a real problem (for example AccessViolation), and where we need the information provided by madExept
We already had an exchange on this many years ago, in one of the ''borland'' forum and you gave a solutions, but I could not find the thread anymore. There are still some traces of MadExept in our code but it is difficult to understand what is going on:
In the ''main'' form we have the following maxexcept related code:
in the use clause:
Code: Select all
{$IFDEF USE_MADEXCEPT}
,MadExcept
{$ENDIF}
in the private section of the form:
Code: Select all
// handler used when MadExcept is active
procedure ExceptionHandler_MadExcept(const ExceptIntf : IMEException;
var Handled : boolean);
which is this procedure:
Code: Select all
procedure TMainForm.ExceptionHandler_MadExcept(
const ExceptIntf: IMEException; var Handled: boolean);
begin
{$IFDEF USE_MADEXCEPT}
if ExceptIntf.ExceptObject is Exception then
ExceptionHandler(Exception(ExceptIntf.ExceptObject), Handled);
{$ENDIF}
end {TMainForm.ExceptionHandler_MadExcept};
and this is in FormCreate:
Code: Select all
{$IFDEF USE_MADEXCEPT}
RegisterExceptionHandler(ExceptionHandler_MadExcept, stTrySyncCallOnSuccess);
{$ENDIF}
In FomCreate we also set the Application.OnException to this routine:
Code: Select all
procedure TMainForm.OnException(Sender: TObject; E: Exception);
var
Handled : boolean;
begin
Handled := false;
ExceptionHandler(E, Handled);
if not Handled then begin
E.Message := Format('%s (0x%s)', [E.Message, IntToHex(integer(ExceptAddr), 8)]);
Application.ShowException(E);
end {if};
end {TMainForm.OnException};
and ExceptionHandler is like this:
ExceptionHandler is:
Code: Select all
procedure TMainForm.ExceptionHandler(E: Exception; var Handled : boolean);
begin
Handled := true; // Assume
if E is EBeep then begin
MessageBeep(0)
end else if E is EOutOfMemory then begin
// ...
end else if E is EOLESysError then begin
// ...
end else if E is EInOutError then begin
with EInOutError(E) do
// ...
end else if E is ECheck then begin
//...
end else if E is EIOError then begin
with EIOError(E) do
//...
end else if E is EHotSpotError then begin
// ...
end else if E is EExecException then begin
// ...
end else if E is EError then begin
// ..
end else if E is EGenError then begin
// ...
end else begin
Handled := false;
end {if};
end {TMainForm.ExceptionHandler};
thank you for your help.
Christian Aymon