exception behaviour

Add-in Express™ Support Service
That's what is more important than anything else

exception behaviour
sysutil.exception 
Mervin Pearce


Guest


If I do this inside adx it does not catch the error and actually fails.
on e: sysutils.Exception do ShowMessage(e.Message);

Is there a way to handle exceptions inside ADX?
Posted 01 Oct, 2015 04:47:59 Top
Andrei Smolin


Add-in Express team


Posts: 18821
Joined: 2006-05-11
Hello Mervin,

In an event handler for what event do you do this?


Andrei Smolin
Add-in Express Team Leader
Posted 01 Oct, 2015 05:21:06 Top
Mervin Pearce


Guest


Thanks for the quick response...
My code

/procedure TAddInModule.adxRibbonTab2Controls1Controls0Click(Sender: TObject;
/ const RibbonControl: IRibbonControl);
/var
/ Mail: _MailItem;
/ IAttachment: Attachment;
/ I: integer;
/ WorkerDir: String;
/begin
/Mail := OutlookApp.ActiveInspector.CurrentItem as _MailItem;
/ if Mail.Attachments.Count > 0 then
/ begin
/ for I := 1 to Mail.Attachments.Count do
/ begin
/ IAttachment := Mail.Attachments.Item(i);
/ if IAttachment.FileName = 'encrypted.pgp' then
/ begin
/ try
/ IAttachment.SaveAsFile(WorkerDir+IAttachment.FileName);
/ except
/ on e: Exception do
/ showmessage(e.message); <--- This seems to trip the system
/ end;
/ end;
/ end;
/ end
Posted 01 Oct, 2015 05:34:04 Top
Andrei Smolin


Add-in Express team


Posts: 18821
Joined: 2006-05-11
Mervin,

Are you sure that there must be an exception in the code above? What exception should occur? In what scenario? May the exception occur outside of the try/except block?


Andrei Smolin
Add-in Express Team Leader
Posted 01 Oct, 2015 07:37:50 Top
Andrew Lockwood


Guest


Is there a way to handle exceptions inside ADX?


To answer your question directly, I can confirm that I use E: SysUtils.Exception successfully within adx, so as Andrei implies, this appears to be a problem with your usage, not with ADX.
Posted 20 Oct, 2015 02:53:46 Top
Mervin Pearce


Guest


Thanks yes... I have not had time to give feedback. You have to use systutils.exception as it seems there is an override with ADX and 'another' exception comes into play.

Best Regards
Mervin Pearce
Posted 20 Oct, 2015 03:36:37 Top
Andrei Smolin


Add-in Express team


Posts: 18821
Joined: 2006-05-11
Mervin,

That's Outlook2000.Exception, I suppose. See also https://www.add-in-express.com/forum/read.php?FID=1&TID=13345


Andrei Smolin
Add-in Express Team Leader
Posted 20 Oct, 2015 03:58:16 Top