Modules/Jobs/Exceptions.vb

87 lines
2.4 KiB
VB.net

Imports System.Collections.Generic
Imports System.IO
Imports DigitalData.Modules.Interfaces.PropertyValues
Imports DigitalData.Modules.Interfaces.ZUGFeRDInterface
Public Class Exceptions
Public Class MissingValueException
Inherits ApplicationException
Public ReadOnly File As FileInfo
Public ReadOnly MissingProperties As List(Of MissingProperty)
Public Sub New(pFile As FileInfo, pMissingProperties As List(Of MissingProperty))
MyBase.New($"Missing values in [{pFile.Name}]")
Me.File = pFile
Me.MissingProperties = pMissingProperties
End Sub
End Class
Public Class TooMuchFerdsException
Inherits ApplicationException
Public Sub New()
MyBase.New("More than one ZUGFeRD document found")
End Sub
End Class
Public Class FileSizeLimitReachedException
Inherits ApplicationException
Public Const KEY_FILENAME = "FILENAME"
Public Sub New(pFilePath As String, pFileSizeLimitInMegaBytes As Integer)
MyBase.New($"At least one file exceeded the filesize limit of {pFileSizeLimitInMegaBytes}MB: {pFilePath}")
Data.Add(KEY_FILENAME, pFilePath)
End Sub
End Class
Public Class InvalidFerdException
Inherits ApplicationException
Public Sub New()
MyBase.New("ZUGFeRD document found but was not formatted correctly")
End Sub
End Class
Public Class UnsupportedFerdException
Inherits ApplicationException
Public ReadOnly Property XmlFile As String
Public Sub New(pXmlFile As String)
MyBase.New("ZUGFeRD document found but is not supported!")
_XmlFile = pXmlFile
End Sub
End Class
Public Class NoFerdsException
Inherits ApplicationException
Public Sub New()
MyBase.New("No ZUGFeRD documents found")
End Sub
End Class
Public Class NoFerdsAlternateException
Inherits ApplicationException
Public Sub New()
MyBase.New("No ZUGFeRD documents found, no rejection will be generated")
End Sub
End Class
Public Class MD5HashException
Inherits ApplicationException
Public ReadOnly FileName As String
Public Sub New(pMessage As String, pFileName As String)
MyBase.New(pMessage)
FileName = pFileName
End Sub
End Class
End Class