8.2 Error Object

The entry point to Error properties and methods.

8.2.1 Description property

Sets or returns a descriptive string associated with an error.

Syntax

 object.Description[=Desc As String]
 

Type

String.

Attributes

Read/write.

Remarks

Desc is an optional parameter that specifies an error description.

Example

This example sets a descriptive string associated with the error.

 err.Description="Invalid path is given" 
 print(err.Description)
 

8.2.2 Number property

Sets or returns a numeric value specifying an error.

Syntax

 object.Number[=Err As Integer]
 

Type

Long.

Attributes

Read/write.

Remarks

Err is an optional parameter that specifies a numeric error value.

Example

This example sets the numeric value 123.

 err.number=123 
 print(err.number)
 

8.2.3 Source property

Returns or sets the name of the object or application that originally generated the error.

Syntax

 object.Source[=Object As String]
 

Type

String.

Attributes

Read/write.

Remarks

Object is an optional parameter that specifies the name of an object or application.

Example

This example sets the object name to GetChildren.

 err.source="GetChildren" 
 print(err.source)
 

8.2.4 Clear method

Clears all the property settings of the Error object.

Syntax

 object.Clear()
 

Parameters

None.

Return Values

Boolean. Returns TRUE if the error settings are cleared successfully. otherwise, FALSE.

Example

This example clears all the property settings of the Error object.

 print(err.number) 
 err.clear 
 print(err.number)
 

See Also

8.2.5 Raise method

Generates a run-time error.

Syntax

 object.Raise(
    number As Long, 
    [source As String, 
    desc As String]])
 

Parameters

number
Identifies the nature of the error (Long Integer subtype).
source
Optional. The object or application that originally generated the error.
desc
Optional. A description of the error. If unspecified, the value of the number parameter is examined.

Return Values

Boolean. Returns TRUE if the error is generated; otherwise, FALSE.

Example

This example generates a run-time error.

 print (err.Number) 
 print (err.Source) 
 print (err.Description) 
 err.Raise (Number, Source, Description) 
 print (err.Number) 
 print (err.Source) 
 print (err.Description)