Jamal's VBScript reference and several other books I've seen document the err.raise call for generating custom and standard errors. Few if any, however, seem to document the following usage. If anyone knows any reason not to do what I am about to describe, please speak up, because I'm starting to do it. This works on my XP Pro / IE 7 machine.
Documented syntax: err.raise <errorNumber> Apparently undocumented syntax: err.raise <errorNumber>[, <errorSource>[, <errorDescription>]] <errorNumber>: The error number. If you use a standard error number, <errorDescription will be set for you. Otherwise, the default error description is the hexadecimal version of <errorNumber>. <errorSource> (sometimes documented): The source of the error. It is nice to put an object name here when a one of your custom class objects is generating the error. <errorDescription>: The description of the error. Error numbers are supposed to start above VbObjectError somewhere, but I don't see specific rules on exactly where, and at least the error numbers through VbObjectError+18 are already assigned. I am starting to use error numbers starting at VbObjectError+1000 just to be safe. Any better advice for a best practice in this regard is welcome. Example call: err.raise VbObjectError+1000, "MyContainer object", "AddItem called before item is defined" In the absence of an error-handling environment like the one provided by Window-Eyes, this will generate out put like this: C:\Projects\ProjectX\MyProj.vbs(254, 1) MyContainer object: AddItem called before item is defined The various possible Window-Eyes error-handling wrappers (notably default and GWToolkit) will of course adjust that format. -- Doug Lee, Senior Accessibility Programmer SSB BART Group - Accessibility-on-Demand mailto:[email protected] http://www.ssbbartgroup.com "While they were saying among themselves it cannot be done, it was done." --Helen Keller
