Skip to content

Commit 02a94a8

Browse files
committed
Rotator - Add mandatory member tests in line with the revised IRotatorV3 specification
1 parent 387fc6e commit 02a94a8

2 files changed

Lines changed: 132 additions & 63 deletions

File tree

Conform/Devices/DeviceTesterBaseClass.vb

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -783,6 +783,33 @@ Friend Class DeviceTesterBaseClass
783783
End Try
784784
End Function
785785

786+
''' <summary>
787+
''' Test a supplied exception for whether it is a NotImplemented type
788+
''' </summary>
789+
''' <param name="deviceException">The exception sent by the driver</param>
790+
''' <returns>True if the exception is a NotImplemented type</returns>
791+
''' <remarks>Different tests are applied for COM and .NET exceptions</remarks>
792+
Protected Function IsNotImplementedException(deviceException As Exception) As Boolean
793+
Dim COMException As COMException
794+
795+
IsNotImplementedException = False ' Set false default value
796+
797+
Try
798+
If (TypeOf deviceException Is COMException) Then ' This is a COM exception so test whether the error code indicates that it is a not implemented exception
799+
COMException = CType(deviceException, COMException)
800+
If (COMException.ErrorCode = g_ExNotImplemented) Or (COMException.ErrorCode = ErrorCodes.NotImplemented) Then ' This is a not implemented exception
801+
IsNotImplementedException = True
802+
End If
803+
End If
804+
If (TypeOf deviceException Is ASCOM.NotImplementedException) Then
805+
IsNotImplementedException = True
806+
End If
807+
Catch ex As Exception
808+
LogMsg("IsNotImplementedException", MessageLevel.msgWarning, "Unexpected exception: " & ex.ToString())
809+
End Try
810+
End Function
811+
812+
786813
''' <summary>
787814
''' Test a supplied exception for whether it is a PropertyNotImplementedException type
788815
''' </summary>

0 commit comments

Comments
 (0)