O'Reilly logo

VBScript in a Nutshell, 2nd Edition by Ron Petrusha, Matt Childs, Paul Lomax

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Name

Err.Raise Method

Syntax

                  Err.Raise number,  [source], [description], _
             [[helpfile], helpcontext]
number

Use: Required

Data Type: Long integer

A numeric identifier of the particular error.

source

Use: Optional

Data Type: String

The name of the object or application responsible for generating the error.

description

Use: Optional

Data Type: String

A useful description of the error.

helpfile

Use: Optional

Data Type: String

The fully qualified path of a Microsoft Windows Help or HTML Help file containing help or reference material about the error.

helpcontext

Use: Optional

Data Type: Long

The context ID within helpfile.

Description

Generates a runtime error.

Rules at a Glance

  • To use the Raise method, you must specify an error number.

  • If you supply any of the number, source, description, helpfile, and helpcontext arguments when you call the Err.Raise method, they are supplied as values to the Err object’s Number, Source, Description, HelpFile, and HelpContext properties, respectively. Refer to the entries for the individual properties for full descriptions of and rules for each property.

Programming Tips and Gotchas

  • The Raise method doesn’t reinitialize the Err object prior to assigning the values you pass in as arguments. This can mean that if you Raise an error against an Err object that hasn’t been cleared since the last error, any properties you don’t specify values for still contain the values from the last error.

  • As well as using Raise in a runtime scenario, you can put it to good use in the development ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required