Name
Err Object
Description
The Err object contains properties and methods that allow you to obtain information about a single runtime error in a VBScript script. It also allows you to generate errors and to reset the error object. Because the Err object is an intrinsic object (which means that it’s part of every VBScript script you create) with global scope, you don’t need to create an instance of it within your code.
When an error is generated in your application—whether it’s handled or not—the properties of the Err object are assigned values you can then access to gain information about the error that occurred. You can even generate your own errors explicitly using the Err.Raise method. You can also define your own errors to unify the error-handling process.
When your program reaches an On
Error
Resume Next statement,
the Err object is cleared and its properties reinitialized. This can
also be achieved explicitly using the Err.Clear method.
Properties
|
Property Name |
Description |
|---|---|
|
Description |
The string associated with the given error number |
|
HelpContext |
A context ID within a VBScript Help file |
|
HelpFile |
The path to a VBScript Help file |
|
Number |
A long integer used to describe an error (i.e., an error code) |
|
Source |
Either the name of the current project or the class name of the application that generated the error |
Methods
|
Method Name |
Description |
|---|---|
|
Clear |
Resets all the properties of the Err object |
|
Raise |
Forces an error with a particular error code to be generated |
Programming ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access