VERSION 1.0 CLASS
BEGIN
  MultiUse = -1  'True
END
Attribute VB_Name = "clsErrorMaker"
Attribute VB_GlobalNameSpace = True
Attribute VB_Creatable = True
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = True
' Guide to the Perplexed: ErrTest - Error testing program
' Copyright (c) 1996 by Desaware Inc. All Rights Reserved
Option Explicit

' Three functions that divide two numbers

' This one demonstrates an API like approach
Public Function DivideBy1(numerator As Long, denominator As Long, errval As Long) As Long
    If denominator = 0 Then
        ' Catch the error situation
        errval = -1
        Exit Function
    End If
    DivideBy1 = numerator / denominator
End Function

' Let the client handle the error
Public Function DivideBy2(numerator As Long, denominator As Long) As Long
    DivideBy2 = numerator / denominator
End Function

' Basic (exception style) error handling
Public Function DivideBy3(numerator As Long, denominator As Long) As Long
On Error GoTo problem3:
    DivideBy3 = numerator / denominator
    Exit Function
problem3:
    Err.Raise vbObjectError + 1000, "clsErrorMaker", "Error Maker Numeric Error"
End Function


