ZooFlow: Use BaseRibbonForm, deprecate frmAdmin_Base
This commit is contained in:
@@ -8,9 +8,6 @@ Namespace Base
|
||||
Private _Logger As Logger
|
||||
Private _Form As Form
|
||||
|
||||
Private Const UNKNOWN_METHOD = "Unknown Method"
|
||||
Private Const UNKNOWN_FORM = "Unknown Form"
|
||||
|
||||
Public Sub New(LogConfig As LogConfig, Logger As Logger, Form As Form)
|
||||
_LogConfig = LogConfig
|
||||
_Logger = Logger
|
||||
@@ -28,9 +25,7 @@ Namespace Base
|
||||
End Sub
|
||||
|
||||
Private Function GetMessage(Exception As Exception) As String
|
||||
Dim oTargetSite = Exception.TargetSite
|
||||
Dim oMethodName = GetMethodName(Exception)
|
||||
Dim oFormName = GetFormName(Exception)
|
||||
Dim oCallingClass = LogConfig.GetClassFullName(IncludeMethodNames:=True, Parts:=2)
|
||||
Dim oMessage As String = String.Empty
|
||||
|
||||
If TypeOf Exception Is SqlClient.SqlException Then
|
||||
@@ -42,7 +37,7 @@ Namespace Base
|
||||
ElseIf TypeOf Exception Is NoNullAllowedException Then
|
||||
oMessage = "Einige benötigte Felder wurde nicht ausgefüllt."
|
||||
Else
|
||||
oMessage = $"Es ist ein unerwarteter Fehler in {oFormName}/{oMethodName} aufgetreten. Mehr Informationen finden Sie im Log."
|
||||
oMessage = $"Es ist ein unerwarteter Fehler in {oCallingClass} aufgetreten. Mehr Informationen finden Sie im Log."
|
||||
End If
|
||||
|
||||
If _LogConfig.Debug Then
|
||||
@@ -55,49 +50,6 @@ Namespace Base
|
||||
|
||||
Return oMessage
|
||||
End Function
|
||||
|
||||
'Private Function GetMessage(Exception As Exception) As String
|
||||
' Dim oTargetSite = Exception.TargetSite
|
||||
' Dim oMethodName = GetMethodName(Exception)
|
||||
' Dim oFormName = GetFormName(Exception)
|
||||
' Dim oMessage As String = String.Empty
|
||||
|
||||
' oMessage &= $"Form: {oFormName}{vbNewLine}"
|
||||
' oMessage &= $"Method: {oMethodName}{vbNewLine}"
|
||||
|
||||
' If Not String.IsNullOrEmpty(Exception.StackTrace) Then
|
||||
' oMessage &= $"Message: {Exception.Message}{vbNewLine}{vbNewLine}"
|
||||
' End If
|
||||
|
||||
' If Not String.IsNullOrEmpty(Exception.StackTrace) Then
|
||||
' oMessage &= $"Stacktrace: {Exception.StackTrace}{vbNewLine}"
|
||||
' End If
|
||||
|
||||
' oMessage &= $"{vbNewLine}"
|
||||
' oMessage &= $"Please report this error to error@digitaldata.works"
|
||||
|
||||
' Return oMessage
|
||||
'End Function
|
||||
|
||||
Private Function GetMethodName(Exception As Exception) As String
|
||||
Dim oMethodName = Exception.TargetSite?.Name
|
||||
|
||||
If oMethodName Is Nothing Then
|
||||
Return UNKNOWN_METHOD
|
||||
Else
|
||||
Return oMethodName
|
||||
End If
|
||||
End Function
|
||||
|
||||
Private Function GetFormName(Exception As Exception) As String
|
||||
Dim oFormName = Exception.TargetSite?.ReflectedType?.Name
|
||||
|
||||
If oFormName Is Nothing Then
|
||||
Return UNKNOWN_FORM
|
||||
Else
|
||||
Return oFormName
|
||||
End If
|
||||
End Function
|
||||
End Class
|
||||
|
||||
End Namespace
|
||||
|
||||
Reference in New Issue
Block a user