Nicer error messages from OLE?

D

Daniel Berger

Hi all,

Is there a way to get nicer error codes out of OLE (catching, say, a
WIN32OLERuntimeError)? This is ugly:

C:\eclipse\workspace\sys-admin\lib\sys>ruby win32.rb
win32.rb:358:in `add_user': setinfo (Sys::AdminError)
OLE error code:800708B0 in <Unknown>
<No Description>
HRESULT error code:0x80020009
Exception occurred. from win32.rb:374

If possible, I would like to get *only* the OLE error code. In this
case, it would be 800708B0. Based on the MSDN docs, I could then trim
the "8007" and use the remainder. With that, I'm guessing I could run
it through FormatMessage() to get a human-readable string.

I suppose I could manually parse out the error code, but that's kinda
fugly.

Any ideas?

Thanks.

Dan
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,020
Latest member
GenesisGai

Latest Threads

Top