Dictionary Object
FileSystemObject Object
TextStream Object
OBJECT: Err
Implemented in version 1.0
The
Err
object holds information about the last runtime error that occured. It is not nessecary to create an instance of this object; it is intrinsic to VBScript. Its default property is
Number
, which contains an integer representing a VBScript error number or an ActiveX control Status Code (SCODE) number. This value is automatically generated when an error occurs and is reset to zero (no error) after an
On Error Resume Next
statement or after using the
Clear
method.
The following code checks the value of the
Number
property and, if it contains a value other than zero, displays the details in the browser.
Code:
<%
dim numerr, abouterr
On Error Resume Next
Err.Raise 6
numerr = Err.number
abouterr = Err.description
If numerr <> 0 Then
Response.Write "An Error has occured! Error number " & numerr & " of_
the type '" & abouterr & "'."
End If
%>
Output:
"An Error has occured! Error number 6 of the type 'Overflow'."
PROPERTIES
Description
Property
This property returns or sets a string containing a brief textual description of an error.
Syntax:
object.
Description
[ = string]
HelpContext
Property
This property is used to set or return a context ID for a Help topic specified with the
HelpFile
property.
Syntax:
object.
HelpContext
[ = contextID]
HelpFile
Property
This property is used to get or define the path to a Help file.
Syntax:
object.
HelpFile
[ = contextID]
Number
Property
This property is used to retrieve or set the value that relates to a specific runtime error.
Syntax:
object.
Number
[ = errnumber]
Source
Property
This property lets us determine the object or application that caused an error, and returns a string that contains its
Class
name or programmatic ID.
Syntax:
object.
Source
[ = string]
METHODS
Clear Method
This method is used to clear the settings of the Error object.
Syntax:
object.
Clear
Raise
Method
This method is used to generate a VBScript runtime error.
Syntax:
object.
Raise
(number[, source, description, helpfile, helpcontext])
Copyright 1999-2001 by Infinite Software Solutions, Inc. All rights reserved.
Trademark Information