Hunting down VBScript error codes
MSDN’s documentation sucks. Wanting to raise a runtime error in VBScript, I looked up the appropriate method; err.raise on MSDN. The description there is pretty straightforward, until you get to the part where you want to decide on an error number.
number: A Long integer subtype that identifies the nature of the error. VBScript errors (both VBScript-defined and user-defined errors) are in the range 0-65535.
When setting the number property to your own error code in an Automation object, you add your error code number to the constant vbObjectError. For example, to generate the error number 1050, assign vbObjectError + 1050 to the number property.
Aha, I see, but how about the regular errors, what numbers do they have? Luckily there are “See also”-links at the bottom of the page, unfortunatly none of them links to a list of error numbers. Hm, ok, perhaps I have to look up the Number property:
Returns or sets a numeric value specifying an error.
Well duh, that didn’t make me much more informed, and this page doesn’t include a link to existing error numbers anyways. Come on, who would create a page describing error numbers without even trying to list the existing ones?
Time to turn to the lost users’ last resort: The search engine. Inputting “vbscript error numbers” yields me an unknown number of results that does me no good. At least none of the page titles indicates the documents contain a list of error numbers, and I can’t be bothered to check every document. The next 3 pages are equally unhelpful.
Piece of cake! Silly me for trying to look in the logical, related place; The documentation about handling and raising errors. Who’d have thunk a list of errors could’ve been interesting there?
As a sidenote, all pages fail to use titles properly. All property-pages have the title “Properties” and all method-descriptions have “Methods”, making it virtually impossible to distinquish between more than 2 windows with documentation. But it’s not like developers, developers, developers need to look up more than one thing at a time, right?