Built-in "Err" Object Properties and Methods
This section describes the built-in 'Err' object, and its properties and methods, Err.Number, Err.Description, Err.Source, Err.Raise(), Err.Clear().
We have used some properties and method of the "Err" object several times in our examples,
now let's provide a summary about this built-in object:
1. "Err" is a built-in object representing the last runtime error that occurred during the execution.
2. "Err" has the following important properties.
- Err.Number - The code value of the runtime error. For example, Err.Number = 11 is the code
value of the "Division by zero" error. See the list of common error code values below.
- Err.Description - The description string of the runtime error.
- Err.Source - The source string of the runtime error.
3. "Err" has the following important methods.
- Err.Raise(number, source, description) - Raises a new runtime error with your own error code,
source and description.
- Err.Clear() - Clears the current runtime error.
Here is a list of commonly-occurred runtime errors pre-defined in VBScript:
5 Invalid procedure call or argument
7 Out of Memory
9 Subscript out of range
10 This array is fixed or temporarily locked
11 Division by zero
13 Type mismatch
14 Out of string space
17 Can't perform requested operation
28 Out of stack space
35 Sub or function not defined
48 Error in loading DLL
51 Internal error
91 Object variable not set
92 For loop not initialized
94 Invalid use of Null
424 Object required
Table of Contents
About This Book
Introduction of VBScript - Visual Basic Scripting Edition
Variant Data Type, Subtypes, and Literals
Numeric Comparison Operations and Logical Operations
String Operations - Concatenation and Comparison
Variable Declaration and Assignment Statement
Expression and Order of Operation Precedence
Statement Syntax and Statement Types
Array Data Type and Related Statements
Array References and Array Assignment Statements
Conditional Statements - "If ... Then" and "Select Case"
Loop Statements - "For", "While", and "Do"
"Function" and "Sub" Procedures
Inspecting Variables Received in Procedures
►Error Handling Flag and the "Err" Object
Error Handling Rules Overview
IE Option Setting - Enable Script Debugging
"On Error Resume Next" - Turning on Error Handling
"On Error GoTo 0" - Turning off Error Handling
"Err.Number" and "Err.Clear()" - Error Code and Clear Method
►Built-in "Err" Object Properties and Methods
"Err.Raise()" - Raising Your Own Errors
Regular Expression Pattern Match and Replacement
scrrun.dll - Scripting Runtime DLL Library
Creating Your Own Classes
IE Web Browser Supporting VBScript
IIS ASP Server Supporting VBScript
WSH (Windows Script Host)
PDF Printing Version