THE ERR OBJECT :
The err object holds infortion about the last runtime error tht occured.It is not necessary to create an instane og 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 generaed when an error occurs and is rest to zero (no error) after an on error resume next statement or after using the clear method.
Example code:
<%
dim numerr,abouterr
On Error Resume Next
Err.Raise 6
numerr=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'."
Explanation:
This code checks the value of the number property and if it contain a value other than zero,displays the details in the browser.
properties:
Description:
syntax:object.Description [=string]
This property returns or sets a string containing a brief textual description of an error.
Helpcontext:
syntax:object.HelpContext [=contextID]
This property is used to set or return a context ID for a help topic specified with the HelpFile property.
HelpFile:
syntax:object.HelpFile [=contextID]
This property is used to get or define the path to a help file.
Number:
syntax:object.Number [=errnumber]
This property is used to retive or set the value that relates to a specific runtime error.
source:
syntax:object.Source [=string]
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.
methods:
clear:
syntax:object.Clear
This method is used to clear teh settings of the error object.
Raise:
syntax:object.Raise(number[,source,description,helpfile,helpcontext])
This method is used to generte a VBScript runtime error.

0 Comments