exception behaviour

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

exception behaviour
sysutil.exception 
Mervin Pearce




Posts: 26
Joined: 2005-12-06
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: 14094
Joined: 2006-05-11
Hello Mervin,

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

Regards from Belarus (GMT+3),

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




Posts: 26
Joined: 2005-12-06
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: 14094
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?

Regards from Belarus (GMT+3),

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




Posts: 50
Joined: 2014-12-29
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




Posts: 26
Joined: 2005-12-06
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: 14094
Joined: 2006-05-11
Mervin,

That's Outlook2000.Exception, I suppose. See also Conflict between reserved "Break" and Word 2010 "Break (IDispatch)"

Regards from Belarus (GMT+3),

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