@@ -37,30 +37,21 @@ Namespace Scripts
3737 ''' <param name="ex"></param>
3838 ''' <param name="isSilent"></param>
3939 Public Shared Sub DisplayMessage(ex As Exception, Optional isSilent As Boolean = False )
40- Try
41- Dim sf As New System.Diagnostics.StackFrame( 1 )
42- Dim caller As System.Reflection.MethodBase = sf.GetMethod()
43- Dim currentProcedure As String = (caller.Name).Trim()
44- Dim currentFileName As String = "" 'AssemblyInfo.GetCurrentFileName()
45- Dim errorMessageDescription As String = ex.ToString()
46- errorMessageDescription = System.Text.RegularExpressions.Regex.Replace(errorMessageDescription, "\r\n+" , " " )
47-
48- Dim msg As String = "Contact your system administrator. A record has been created in the log file." + Environment.NewLine
49- msg += (Convert.ToString( "Procedure: " ) & currentProcedure) + Environment.NewLine
50- msg += "Description: " + ex.ToString() + Environment.NewLine
51-
52- log.Error( "[PROCEDURE]=|" + currentProcedure + "|[USER NAME]=|" + Environment.UserName + "|[MACHINE NAME]=|" + Environment.MachineName + "|[DESCRIPTION]=|" + errorMessageDescription)
53- If isSilent = False Then
54- MessageBox.Show(msg, "Unexpected Error" , MessageBoxButtons.OK, MessageBoxIcon.Error)
55- End If
56-
57- Catch ex As Exception
58-
59-
60- Finally
61-
62-
63- End Try
40+ Dim sf As New System.Diagnostics.StackFrame( 1 )
41+ Dim caller As System.Reflection.MethodBase = sf.GetMethod()
42+ Dim currentProcedure As String = (caller.Name).Trim()
43+ Dim currentFileName As String = "" 'AssemblyInfo.GetCurrentFileName()
44+ Dim errorMessageDescription As String = ex.ToString()
45+ errorMessageDescription = System.Text.RegularExpressions.Regex.Replace(errorMessageDescription, "\r\n+" , " " )
46+
47+ Dim msg As String = "Contact your system administrator. A record has been created in the log file." + Environment.NewLine
48+ msg += (Convert.ToString( "Procedure: " ) & currentProcedure) + Environment.NewLine
49+ msg += "Description: " + ex.ToString() + Environment.NewLine
50+
51+ log.Error( "[PROCEDURE]=|" + currentProcedure + "|[USER NAME]=|" + Environment.UserName + "|[MACHINE NAME]=|" + Environment.MachineName + "|[DESCRIPTION]=|" + errorMessageDescription)
52+ If isSilent = False Then
53+ MessageBox.Show(msg, "Unexpected Error" , MessageBoxButtons.OK, MessageBoxIcon.Error)
54+ End If
6455
6556 End Sub
6657
0 commit comments