Sample Code

delphi package - automated exception handling
Post Reply
EnvisionIT
Posts: 7
Joined: Tue Sep 08, 2015 3:28 pm

Sample Code

Post by EnvisionIT »

Does anyone have a quick sample they could show on how to change some of the global settings for MadExcept.

I have reviewed the link, but unfort I'm not getting it.

I want to do 2 things:

1. Change email subject to add registered client name.
2. Add additional attachment to the email (config.ini).

I see these statements:
MESettings.AdditionalAttachments.Add('c:\boot.ini');
property IMESettings.MailSubject : string; // mail subject

I have extensive error handling in the app, just trying to use Mad to catch everything else and email it to me.

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

Re: Sample Code

Post by madshi »

You can change settings either globally (for all exceptions) or "locally" (for just the current exception). If you want to change things globally, add "madExcept" to your uses clause, then you can use the function "MESettings()" which will return an IMESettings interface representing all the global properties you can change, like "AdditionalAttachments", "MailSubject" etc. If you want to change things locally, you need to register an exception callback by using RegisterExceptionHandler, and your callback will then get a parameter "exceptIntf: IMEException" which inherits from IMESettings. You can change all the same settings through that interface, too, local to the current exception.

Hope that helps?
softlinkuser
Posts: 4
Joined: Mon Jun 20, 2016 7:18 am

Re: Sample Code

Post by softlinkuser »

Hi. I'm trying to do something similar, I want to change the setting globally. Do i need to add "MadExcept" to the uses clause in every unit in my project ?
madshi
Site Admin
Posts: 10754
Joined: Sun Mar 21, 2004 5:25 pm

Re: Sample Code

Post by madshi »

No, just in those units where you want to access madExcept APIs.
softlinkuser
Posts: 4
Joined: Mon Jun 20, 2016 7:18 am

Re: Sample Code

Post by softlinkuser »

Thank you for the prompt reply. Works perfectly !
Post Reply