VERSION 1.0 CLASS
BEGIN
  MultiUse = -1  'True
  Persistable = 0  'NotPersistable
  DataBindingBehavior = 0  'vbNone
  DataSourceBehavior  = 0  'vbNone
  MTSTransactionMode  = 0  'NotAnMTSObject
END
Attribute VB_Name = "clsFOTAErrors"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = True
Attribute VB_PredeclaredId = False
Attribute VB_Exposed = True
Option Explicit

Private m_oErrors As New Collection

Public Sub Clear()
    While m_oErrors.Count > 0
        Call m_oErrors.Remove(1)
    Wend
End Sub
Public Function Col() As Collection
    Set Col = m_oErrors
End Function
'Modal is locked, Modeless is not locked
Public Sub DisplayErrorStack()
    Call Load(frmErrorDisplay)
    Call frmErrorDisplay.DisplayStack(Me)
    Call Clear
End Sub
'Modal is locked, Modeless is not locked
Public Sub DisplayErrorCount()
    Call Load(frmErrorDisplay)
    Call frmErrorDisplay.DisplayErrorCount(Me)
    Call Clear
End Sub
Public Function Count_Errors() As Long
    Dim oError As Variant
    For Each oError In m_oErrors
        If oError.bError = True Then Count_Errors = Count_Errors + 1
    Next oError
End Function
Public Function Count_Warnings() As Long
    Dim oError As clsFOTAError
    For Each oError In m_oErrors
        If oError.bError = False Then Count_Warnings = Count_Warnings + 1
    Next oError
End Function
Public Function Count() As Long
    Count = m_oErrors.Count
End Function
Public Sub AddErrors(oErrors As clsFOTAErrors)
    Dim oErr As clsFOTAError
    For Each oErr In m_oErrors
        Call AddError(oErr.sDescription, oErr.nNumber, oErr.sSource, oErr.bError)
    Next oErr
End Sub
Public Sub AddError(sDescription As String, _
                    nNumber As Long, _
                    sSource As String, _
                    Optional bError As Boolean = True)

    Dim oError As New clsFOTAError
    
    oError.nNumber = nNumber
    oError.sDescription = sDescription
    oError.sSource = sSource
    oError.bError = bError
    
    Call m_oErrors.Add(oError)
    
End Sub
Public Sub HandleError(oMyErr As ErrObject)
    Call HandleErrorWithSource(oMyErr, oMyErr.Source)
End Sub
Public Sub HandleErrorWithSource(oMyErr As ErrObject, sSource As String)
    If Not oMyErr.Number = 0 Then
        Call AddError(oMyErr.Description, oMyErr.Number, sSource)
    End If
    Call oMyErr.Clear
End Sub
