customize MadExcept parameters (message, icon...) based on the Exception class?

delphi package - automated exception handling
Post Reply
zbeleh
Posts: 15
Joined: Tue Jan 19, 2021 7:14 pm

customize MadExcept parameters (message, icon...) based on the Exception class?

Post by zbeleh »

some exceptions classes are more severe than others, some may be system failures, others may be critical to operations, and others even, just a user input error.
I have already customized many aspects of the bug report, and this has been working great.

But is there a way to apply different customizations at run-time, depending on the exception being raised?

Thanks!
madshi
Site Admin
Posts: 10754
Joined: Sun Mar 21, 2004 5:25 pm

Re: customize MadExcept parameters (message, icon...) based on the Exception class?

Post by madshi »

Different icons are currently not (easily) supported. However, you can customize almost everything else at runtime rather easily.

For example, try something like this:

Code: Select all

uses madExcept;

procedure AdjustExceptMsg(const exceptIntf: IMEException; var handled: boolean);
begin
  if exceptIntf.ExceptClass = 'EAccessViolation' then
    exceptIntf.ExceptMsg := 'Oh noes, this is really bad!!';
end;

initialization
  RegisterExceptionHandler(AdjustExceptMsg, stDontSync, epQuickFiltering);
end.
zbeleh
Posts: 15
Joined: Tue Jan 19, 2021 7:14 pm

Re: customize MadExcept parameters (message, icon...) based on the Exception class?

Post by zbeleh »

that worked, thanks!

will manage without the icon customization for now :D
Post Reply