PxPlus User Forum

Twitter Twitter Twitter

Author Topic: ERR option ignored  (Read 774 times)

Thomas Bock

  • Diamond Member
  • *****
  • Posts: 177
    • View Profile
ERR option ignored
« on: July 20, 2022, 10:42:32 AM »
For a few weeks we encounter a strange error 65 every now and then, when our programs create a COM object.
Code: [Select]
ON_CREATE:
def object outlook, "[LCL]Outlook.Application", err = *next
if not(tcb(2)) then nameSpace = outlook'getNameSpace("MAPI")
return
This has been a save way ever since. On the WindX side MSG(-1) returns "Exception occured (err/ret=2/0)"
According to Eric we should check for the object reference > 0. But I wonder why the err option is ignored in these cases.

Mike King

  • Diamond Member
  • *****
  • Posts: 3810
  • Mike King
    • View Profile
    • BBSysco Consulting
Re: ERR option ignored
« Reply #1 on: July 21, 2022, 08:35:14 AM »
Thomas

Can you confirm the error is on the DEF OBJECT or the call to getNameSpace?
Mike King
President - BBSysco Consulting
eMail: mike.king@bbsysco.com

Thomas Bock

  • Diamond Member
  • *****
  • Posts: 177
    • View Profile
Re: ERR option ignored
« Reply #2 on: July 25, 2022, 01:21:13 AM »
Mike

The error is thrown by the NEW() function. The constructor as already been left, so I cannot check anything inside the object any more.

Mike King

  • Diamond Member
  • *****
  • Posts: 3810
  • Mike King
    • View Profile
    • BBSysco Consulting
Re: ERR option ignored
« Reply #3 on: July 25, 2022, 09:24:46 AM »
I am not certain I follow what is happening. 

If you have an error on the DEF OBJECT you probably should force an error exit on the ON_CREATE otherwise your object will be instantiated without a valid Outlook object.

As for why the object creation fails, we have seen instances where Outlook itself is busy doing something (asking a user a question such as "Delete email?". updating mail from host, sending mail, updating calendar, ...) it doesn't accept a new connection.
Mike King
President - BBSysco Consulting
eMail: mike.king@bbsysco.com