[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

comp.lang.ruby

Nicer error messages from OLE?

djberg96

4/3/2005 10:26:00 PM

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