Sideway BICK BlogSideway BICK BLOG from Sideway

A Sideway to Sideway Home

Link:http://output.to/sideway/default.asp?qno=180500012

Script, Scripting Language, VBScript elements, Server-Side VBScript Object Element Err Method

VBScript Methods of Err Object

Some typical predefined Elements are.

  • Err Object:
    • Clear Method
    • Raise Method

Clear Method

last updated 12/10/2017

is to clear all property settings of the Err object.

Syntax

Err.Clear

Argument

Err.ClearRequired Keywords. The keywords used to specify the Clear Method of the Err Object.

Remarks

  • The object instance is always the Err object.
  • Clear Method is used to explicitly clear the Err object after an error has been handled.
  • This can be useful, for example, when error handling is deffered with On Error Resume Next.
  • Visual Basic Scripting Edition (VBScript) calls the Clear method automatically whenever the On Error Resume Next statement is executed.

Requirement

1

Applied to

Err Object

Raise Method

last updated 12/10/2017

is to generate a run-time error result of the given number and together with other specifed optional source, description, helpfile, helpcontext in the Err Object.

Syntax

Err.Raise(number[, source, description, helpfile, helpcontext])

Argument

Err.RaiseRequired Keywords. The keywords used to specify the Raise Method of the Err Object. numberRequired. A Long integer subtype that identifies the nature of the error. VBScript errors (both VBScript-defined and user-defined errors) are in the range 0–65535.sourceOptional. A string expression naming the object or application that originally generated the error. When setting this property for an Automation object, use the form project.class. If nothing is specified, the programmatic ID of the current VBScript project is used.descriptionOptional. A string expression describing the error. If unspecified, the value in number is examined. If it can be mapped to a VBScript run-time error code, a string provided by VBScript is used as description. If there is no VBScript error corresponding to number, a generic error message is used.helpfileOptional. The fully qualified path to the Help file in which help on this error can be found. If unspecified, VBScript uses the fully qualified drive, path, and file name of the VBScript Help file.helpcontextOptional. The context ID identifying a topic within helpfile that provides help for the error. If omitted, the VBScript Help file context ID for the error corresponding to the number property is used, if it exists.

Remarks

  • All the arguments are optional except number.
  • If using Raise Method, however, without specifying some arguments, and the property settings of the Err object contain values that have not been cleared, those values become the values for the error.
  • When setting the number property to the error code in an Automation object, the error code number is addd to the constant vbObjectError. For example, to generate the error number 1050, assign vbObjectError + 1050 to the number property.

Requirement

1

Applied to

Err Object

Sideway BICK Blog

12/05


Copyright © 2000-2020 Sideway . All rights reserved Disclaimerslast modified on 26 January 2013