Modules.Interfaces: Try/Catch und logging

This commit is contained in:
PitzM 2025-07-25 13:01:45 +02:00
parent b534c4c799
commit a5226a8101

View File

@ -133,19 +133,40 @@ Public Class ZUGFeRDInterface
End Sub End Sub
Public Function FilterPropertyMap(pPropertyMapList As List(Of XmlItemProperty), pSpecification As String) As Dictionary(Of String, XmlItemProperty) Public Function FilterPropertyMap(pPropertyMapList As List(Of XmlItemProperty), pSpecification As String) As Dictionary(Of String, XmlItemProperty)
_logger.Debug("Filtering Property map for Specification [{0}]", pSpecification) _logger.Debug("Filtering Property map list for Specification [{0}]", pSpecification)
If pSpecification = ZUGFERD_SPEC_10 Then If pSpecification = ZUGFERD_SPEC_10 Then
_logger.Debug("Special Case [{0}], including [{1}]", ZUGFERD_SPEC_10, ZUGFERD_SPEC_DEFAULT) Try
Return pPropertyMapList.
Where(Function(kv) kv.Specification = pSpecification Or kv.Specification = ZUGFERD_SPEC_DEFAULT). _logger.Debug("Special Case [{0}], including [{1}]", ZUGFERD_SPEC_10, ZUGFERD_SPEC_DEFAULT)
ToDictionary(Function(kv) kv.XMLPath, Function(kv) kv)
Dim countElements As Integer = pPropertyMapList.Where(Function(x) x.Specification = pSpecification Or x.Specification = ZUGFERD_SPEC_DEFAULT).Count
_logger.Debug("Property map list contains [{0}] elements for specification [{1}]", countElements, pSpecification)
Return pPropertyMapList.
Where(Function(kv) kv.Specification = pSpecification Or kv.Specification = ZUGFERD_SPEC_DEFAULT).
ToDictionary(Function(kv) kv.XMLPath, Function(kv) kv)
Catch ex As Exception
_logger.Error(ex)
End Try
Else Else
_logger.Debug("Using Specification [{0}]", pSpecification)
Return pPropertyMapList. Try
Where(Function(kv) kv.Specification = pSpecification).
ToDictionary(Function(kv) kv.XMLPath, Function(kv) kv) Dim countElements As Integer = pPropertyMapList.Where(Function(x) x.Specification = pSpecification).Count
_logger.Debug("Property map list contains [{0}] elements for specification [{1}]", countElements, pSpecification)
Return pPropertyMapList.
Where(Function(kv) kv.Specification = pSpecification).
ToDictionary(Function(kv) kv.XMLPath, Function(kv) kv)
Catch ex As Exception
_logger.Error(ex)
End Try
End If End If
Return Nothing
End Function End Function
Public Function GetSerializedXMLContentFromFile(oFileInfo As FileInfo) As ZugferdResult Public Function GetSerializedXMLContentFromFile(oFileInfo As FileInfo) As ZugferdResult