#99795 - 2003-03-19 06:37 PM
FAQ Disscussion - Error Msg Lookup
|
Chris S.
MM club member
   
Registered: 2002-03-18
Posts: 2368
Loc: Earth
|
I did a little tweaking of Howard's ConvertCOMError() function. It goes a little like this...
code:
fnConvertCOMErr(-2147352567) @ERROR " : " @SERROR ?
Function fnConvertCOMErr($sErr) If $sErr<0 $sErr=VAL("&"+Right(DecToHex($sErr),4)) EndIf Exit $sErr Endfunction
The benefit is that the error code is now converted for the @ERROR and @SERROR macro without having to resort to "net helpmsg" which isn't available on all operating systems. [ 19. March 2003, 18:39: Message edited by: Chris S. ]
|
|
Top
|
|
|
|
#99797 - 2003-03-19 08:16 PM
Re: FAQ Disscussion - Error Msg Lookup
|
Howard Bullock
KiX Supporter
   
Registered: 2000-09-15
Posts: 5809
Loc: Harrisburg, PA USA
|
Great job Chris! That is worthy of a Golf trophy. You have taken code of 121 characters and reduced it to 103 characters while adding more KiXtart functionality.
|
|
Top
|
|
|
|
#99799 - 2003-03-19 09:41 PM
Re: FAQ Disscussion - Error Msg Lookup
|
Howard Bullock
KiX Supporter
   
Registered: 2000-09-15
Posts: 5809
Loc: Harrisburg, PA USA
|
Lonk, you have too much time on your hands.
Chris, could this be made more generic by (using Lonk's IIF code) by returning the input value if it is >= 0? Or do we never see a COM error return anything zero and above?
code:
Function fnConvertCOMErr($sErr) Exit Iif($sErr<0,VAL("&"+Right(DecToHex($sErr),4)),VAL($sErr)) Endfunction
|
|
Top
|
|
|
|
#99803 - 2003-03-19 10:07 PM
Re: FAQ Disscussion - Error Msg Lookup
|
Chris S.
MM club member
   
Registered: 2002-03-18
Posts: 2368
Loc: Earth
|
BTW, I posted this for two reasons... - To update the Error Checking FAQ
- To start a discussion on adding a new SETOPTION to automatically convert COM errors to "real" error codes.
|
|
Top
|
|
|
|
#99804 - 2003-03-19 10:09 PM
Re: FAQ Disscussion - Error Msg Lookup
|
Chris S.
MM club member
   
Registered: 2002-03-18
Posts: 2368
Loc: Earth
|
Sorry Les, busy today. Sentences using verbs and nouns only.
|
|
Top
|
|
|
|
#99806 - 2003-03-20 09:34 PM
Re: FAQ Disscussion - Error Msg Lookup
|
NTDOC
Administrator
   
Registered: 2000-07-28
Posts: 11634
Loc: Space
|
Chris,
Could you post code with PostPrep when possible... sooooo much easier to copy and use right away.
|
|
Top
|
|
|
|
#99810 - 2003-03-21 02:26 AM
Re: FAQ Disscussion - Error Msg Lookup
|
Chris S.
MM club member
   
Registered: 2002-03-18
Posts: 2368
Loc: Earth
|
Published function here: fnCOMErr()
|
|
Top
|
|
|
|
Moderator: Arend_, Allen, Jochen, Radimus, Glenn Barnas, ShaneEP, Ruud van Velsen, Mart
|
1 registered
(Allen)
and 1607 anonymous users online.
|
|
|