How do I respond to an error in my calling module when the error was generated with my object?
This is what I have:
Calling Module
ClassCode:Private sp As SwitchPack_Class Public Sub Cal_switchpack(ByVal sp_config As Byte) On Error GoTo errhandler '... code Set sp = New SwitchPack_Class sp.IR = 512 '... other code exit sub errhandler: msgbox "Handled error" .... End sub
At the moment the error gets passed back to the property get function but I cant seem to pass it back to the Cal_Swithpack module. I dont want to use aCode:Public Property Get IR() As Integer On Error GoTo errhandler IR = GetButton(12, RAW) Exit Property errhandler: err.Raise err.Number, err.Source, err.Description ' pass error back to calling module End Property Private Function GetButton(ByVal button, ByVal mode As Byte) As Integer '... other code.... err.Raise 40001, "Switch Pack Object", "Timeout reading SwitchPack button" '... more code end functionas this would make my nice neat function into a massive messy one. Any ideas?Code:if abort=false then sp.ir=12
Cheers




Reply With Quote