Hello everyone.
I have a PB application which calls Outlook to send messages. I want to trap and log errors if any. Here is my code:
ole_Item = ole_Outlook.CreateItem(0)
ole_Item.HTMLBody = ls_Body
ole_Item.Subject
= 'Test message from PowerBuilder'
ole_Item.To
= ls_To
ole_Item.SentOnBehalfOfName
= 'Some User<someone@somewhere.com>'
Try
ole_Item.Send()
Catch(RuntimeError
ex)
MessageBox('ole error', ex.Text)
End
Try
I do not have permissions to send as that user so this should give me an error. But my code does not catch the exception. Instead I get the PB "Error calling external object function..." message. I also tried with oleRuntimeError but still the same result.
What am I doing wrong?
You have to set your stop before or after the debug. Might even work when you set the stop on a line within your catch, but not on the catch itself or anything within the try.
Funny though that you say it doens't work when you do NOT run in debug mode. :S