svn commit: samba r16030 - in branches/SOC/bnh: .

brad at samba.org brad at samba.org
Sat Jun 3 18:58:35 GMT 2006


Author: brad
Date: 2006-06-03 18:58:35 +0000 (Sat, 03 Jun 2006)
New Revision: 16030

WebSVN: http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=rev&root=samba&rev=16030

Log:
Cleaned up the formatting, added const's for extended errors encountered so far.
Added copyright statement and a short description of the file.
Added a function to report error codes and descriptions based on the contents of the err object.


Modified:
   branches/SOC/bnh/common.vbs


Changeset:
Modified: branches/SOC/bnh/common.vbs
===================================================================
--- branches/SOC/bnh/common.vbs	2006-06-03 18:54:31 UTC (rev 16029)
+++ branches/SOC/bnh/common.vbs	2006-06-03 18:58:35 UTC (rev 16030)
@@ -1,6 +1,22 @@
+' A VBScript providing some common library functions for handling
+' passed-in parameters and reporting run-time errors.
+' Copyright Brad Henry <brad at samba.org> 2006
+' Released under the GNU GPL v2 or later.
+
+' Don't halt on runtime errors, we will catch them.
+on error resume next
+
 const RTN_OK = 0
 const RTN_ERR = 1
 
+' We don't have WMI or ADSI extended errors in VBScript.
+' To figure them out, take the last 4 digits of the hex error code,
+' and convert them to an integer. Then search for that integer
+' in the PlatformSDK headers.
+' hextodec.vbs performs the needed conversion.
+const ADSI_ERROR_DS_NO_SUCH_OBJECT	= "80072030" ' PlatformSDK WinError.h
+const LM_NERR_PasswordTooShort		= "800708C5" ' PlatformSDK LMErr.h
+
 set stdout = wscript.stdout
 set stdin = wscript.stdin
 
@@ -38,3 +54,13 @@
 		missing_options = array(25)
 	end sub
 end class
+
+public function report_error
+	if err.description = "" then
+		error_text = "No description provided."
+	else
+		error_text = err.description
+	end if
+	stdout.writeline "Error " & err.number & "(0x" & Hex(err.number) _
+	& "): " & error_text
+end function



More information about the samba-cvs mailing list