From a9554064642f71a4f952b7108d37a852900a9c78 Mon Sep 17 00:00:00 2001 From: Jonathan Jenne Date: Thu, 11 Mar 2021 10:41:21 +0100 Subject: [PATCH 1/2] Database: Better logging of errors --- Modules.Database/MSSQLServer.vb | 28 +++++++++++++++++++--------- 1 file changed, 19 insertions(+), 9 deletions(-) diff --git a/Modules.Database/MSSQLServer.vb b/Modules.Database/MSSQLServer.vb index 841968ef..59f22200 100644 --- a/Modules.Database/MSSQLServer.vb +++ b/Modules.Database/MSSQLServer.vb @@ -161,7 +161,8 @@ Public Class MSSQLServer End Using End Using Catch ex As Exception - _Logger.Warn($"GetDatatable failed SQLCommand [{SqlCommand}] - ERROR: {ex.Message}") + _Logger.Error(ex) + _Logger.Warn($"GetDatatable failed SQLCommand [{SqlCommand}]") Return Nothing End Try End Function @@ -196,6 +197,7 @@ Public Class MSSQLServer End Using End Using Catch ex As Exception + _Logger.Error(ex) _Logger.Warn($"GetDatatableWithConnection failed with SQLCommand [{SqlCommand}] and ConnectionString [{MaskConnectionString(ConnectionString)}]") Return Nothing End Try @@ -241,7 +243,8 @@ Public Class MSSQLServer End Using End Using Catch ex As Exception - _Logger.Warn($"GetDatatableWithConnection2 failed SQLCommand [{SqlCommand}] - ERROR: {ex.Message}") + _Logger.Error(ex) + _Logger.Warn($"GetDatatableWithConnection2 failed SQLCommand [{SqlCommand}]") Return Nothing End Try @@ -264,7 +267,8 @@ Public Class MSSQLServer End Using End Using Catch ex As Exception - _Logger.Warn($"ExecuteNonQuery failed SQLCommand [{SQLCommand}] - ERROR: {ex.Message}") + _Logger.Error(ex) + _Logger.Warn($"ExecuteNonQuery failed SQLCommand [{SQLCommand}]") Return False End Try @@ -287,7 +291,8 @@ Public Class MSSQLServer SQLconnect.Close() Return True Catch ex As Exception - _Logger.Warn($"ExecuteNonQueryCS failed SQLCommand [{pSQLCommand}] - ERROR: {ex.Message}") + _Logger.Error(ex) + _Logger.Warn($"ExecuteNonQueryCS failed SQLCommand [{pSQLCommand}]") Return False End Try @@ -320,7 +325,8 @@ Public Class MSSQLServer End Using End Using Catch ex As Exception - _Logger.Warn($"GetScalarValue failed SQLCommand [{SQLCommand}] - ERROR: {ex.Message}") + _Logger.Error(ex) + _Logger.Warn($"GetScalarValue failed SQLCommand [{SQLCommand}]") Return Nothing End Try @@ -353,7 +359,8 @@ Public Class MSSQLServer End Using End Using Catch ex As Exception - _Logger.Warn($"GetScalarValueWithConnection failed SQLCommand [{SQLCommand}] - ERROR: {ex.Message}") + _Logger.Error(ex) + _Logger.Warn($"GetScalarValueWithConnection failed SQLCommand [{SQLCommand}]") Return Nothing End Try End Function @@ -383,7 +390,8 @@ Public Class MSSQLServer Return SQLCommand.Parameters(OutputParameter).Value End Using Catch ex As Exception - _Logger.Warn($"GetScalarValue failed SQLCommand [{SQLCommand}] - ERROR: {ex.Message}") + _Logger.Error(ex) + _Logger.Warn($"GetScalarValue failed SQLCommand [{SQLCommand}]") Return Nothing End Try @@ -407,7 +415,8 @@ Public Class MSSQLServer SQLconnect.Close() Return result Catch ex As Exception - _Logger.Warn($"GetScalarValueConStr failed SQLCommand [{pSQLCommand}] - ERROR: {ex.Message}") + _Logger.Error(ex) + _Logger.Warn($"GetScalarValueConStr failed SQLCommand [{pSQLCommand}]") Return Nothing End Try End Function @@ -440,7 +449,8 @@ Public Class MSSQLServer End Using End Using Catch ex As Exception - _Logger.Warn($"NewExecuteNonQueryAsync failed SQLCommand [{SqlCommand}] - ERROR: {ex.Message}") + _Logger.Error(ex) + _Logger.Warn($"NewExecuteNonQueryAsync failed SQLCommand [{SqlCommand}]") End Try End Sub From 83640ff64b104e1ec7c74d19ebe0a0a0195ad42b Mon Sep 17 00:00:00 2001 From: Jonathan Jenne Date: Thu, 11 Mar 2021 10:41:33 +0100 Subject: [PATCH 2/2] Database: Version 1.2.3 --- Modules.Database/My Project/AssemblyInfo.vb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Modules.Database/My Project/AssemblyInfo.vb b/Modules.Database/My Project/AssemblyInfo.vb index 695166e6..6de0b4b6 100644 --- a/Modules.Database/My Project/AssemblyInfo.vb +++ b/Modules.Database/My Project/AssemblyInfo.vb @@ -31,5 +31,5 @@ Imports System.Runtime.InteropServices ' übernehmen, indem Sie "*" eingeben: ' - - + +