Sampling Error Handling

The following code snippet is a suggested manner for correctly handling errors raised by RadiusCore. It specifically handles RadiusCore errors differently to other errors that may occur in your code.

Public Sub radius_Sample()
     ' Set error handling at beginning of method.
     On Error GoTo radius_ErrorHandling

     ' Call RadiusCore CLI method. e.g.
    RadiusCore.Refresh True

     ' Do other things here...
     Exit Sub

     Select Case Err.Number - vbObjectError
     Case 72010 to 72012 ' These are the `generic` RadiusCore error codes.
         MsgBox Err.Description, vbExclamation + vbOKOnly, "My App Name"
     Case 72020, 72021 ' These will be raised if an error occurs within a RadiusCore procedure.
            MsgBox "A RadiusCore error occured during my custom macro:" & vbNewLine & _
                Err.Description & vbNewLine, vbCritical + vbOKOnly, "My App Name"
     Case Else ' This will capture errors not raised by RadiusCore.
         MsgBox "Non-RadiusCore error occured here.", vbCritical + vbOKOnly, "My App Name"
     End Select
End Sub`