Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

OLERuntimeError text not helpful

116 views
Skip to first unread message

Dan Cooperstock

unread,
Sep 6, 2009, 4:37:49 PM9/6/09
to
I'm using a COM control, and trying to catch the errors in it with
try/catch blocks and the OLERuntimeError. The error is being thrown, but
the text of that error object (or equivalently the return from GetMessage
()) is of the form:

"Error calling external function .... at line ... in function ... of object
..."

This isn't very helpful, because it doesn't include the real text of the
message that the COM control is sending. If I try this with an equivalent
JScript example via Windows Scripting Host, and get the description of the
same error, I get a helpful message (such as "Failed to decompress data" -
it's a compression/encryption COM control).

I can't see any other properties of the OLERuntimeError object from which I
could get this real error text. Anybody got any bright ideas? Thanks.

---------------------------
Dan Cooperstock
DONATION web site: http://www.Software4Nonprofits.com
DONATION Support forums: http://forums.Software4Nonprofits.com
Email: mailto:in...@Software4Nonprofits.com
Phone: 416-423-7722

Dan Cooperstock

unread,
Sep 6, 2009, 9:24:13 PM9/6/09
to
Dan Cooperstock <in...@Software4NonProfits.com> wrote in
news:Xns9C7EA92D0690Ein...@192.138.151.106:

> I'm using a COM control, and trying to catch the errors in it with
> try/catch blocks and the OLERuntimeError. The error is being thrown,
> but the text of that error object (or equivalently the return from
> GetMessage ()) is of the form:
>
> "Error calling external function .... at line ... in function ... of
> object ..."
>
> This isn't very helpful, because it doesn't include the real text of
> the message that the COM control is sending. If I try this with an
> equivalent JScript example via Windows Scripting Host, and get the
> description of the same error, I get a helpful message (such as
> "Failed to decompress data" - it's a compression/encryption COM
> control).
>
> I can't see any other properties of the OLERuntimeError object from
> which I could get this real error text. Anybody got any bright ideas?
> Thanks.

I figured out how to get the proper error message from the COM control -
use the old method, of creating a user object that inherits from
OLEObject, and hande the error in the ExternalException event of that
object. The error message is then in the "description" argument to that
event.

The thing that I find a bit suprising about this is that the
documentation clearly indicates that using try/catch blocks with an
OLERuntimeError object as the exception is supposed to supercede the old
way with the user object and the ExternalException event. But less
helpful information is available, when you use the "new way"!

I'm using PB 10.2 - is this perhaps something that has been improved,
maybe with additional properties in the OLERuntimeError object, in
subsequent versions?

KL

unread,
Sep 8, 2009, 4:33:44 PM9/8/09
to
I believe GetMessage() returns the .text propery. You want
the .description property of the error object.
HTH KL

> I'm using a COM control, and trying to catch the errors in
> it with try/catch blocks and the OLERuntimeError. The
> error is being thrown, but the text of that error object
> (or equivalently the return from GetMessage ()) is of the
> form:
>
> "Error calling external function .... at line ... in

> function ... of object ...."

Dan Cooperstock

unread,
Sep 8, 2009, 8:41:32 PM9/8/09
to
KL wrote in news:4aa6bfa8.14d...@sybase.com:

>
> I believe GetMessage() returns the .text propery. You want
> the .description property of the error object.
> HTH KL

The RuntimeError, and thus OLERuntimeError, object does not have a
"description" property. That's why I had to go back to "the old way" (as
described in my follow-up post), inheriting an object from OLEObject, and
scripting its ExternalException event. That event has a description
argument, which contains the correct value.

KL

unread,
Sep 9, 2009, 1:15:22 PM9/9/09
to
Check your help file.
OLERuntimeError has a description property,
RuntimeError does not.
KL
0 new messages