Page 1 of 1

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

Posted: Sat Feb 26, 2022 2:40 pm
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!

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

Posted: Sat Feb 26, 2022 6:12 pm
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.

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

Posted: Sat Feb 26, 2022 8:33 pm
by zbeleh
that worked, thanks!

will manage without the icon customization for now :D