Revert "commit"
This commit is contained in:
59
_VERAG_PROG_ALLGEMEIN/cErrorHandler1.vb
Normal file
59
_VERAG_PROG_ALLGEMEIN/cErrorHandler1.vb
Normal file
@@ -0,0 +1,59 @@
|
||||
Imports System.Net.Mail
|
||||
|
||||
Public Class cErrorHandler
|
||||
|
||||
Public Shared Sub ERR(message As String, stack As String, functionName As String, Optional OP As String = "", Optional title As String = "", Optional mailadess As String = "al@erag.ag", Optional recieverMailAdress As String = "", Optional zusatz As String = "")
|
||||
If OP = "" Then OP = VERAG_PROG_ALLGEMEIN.cAllgemein.ERR_OP_GLOBAL ' GLobal gesetzes Errorhandling! (Standart=SHOW)
|
||||
Select Case OP
|
||||
Case ERROR_OP.MAIL
|
||||
sendERRORperMail(title, message, stack, mailadess, zusatz)
|
||||
Case ERROR_OP.SHOW
|
||||
' MsgBox("Fehler in der Funktion '" & System.Reflection.MethodInfo.GetCurrentMethod.Name & "'" & vbNewLine & vbNewLine & ex.Message)
|
||||
MsgBox(If(functionName <> "", "Fehler in der Funktion '" & functionName & "'" & vbNewLine & vbNewLine, "") & message & vbNewLine & stack & vbNewLine & zusatz, MsgBoxStyle.OkOnly, If(title <> "", title, "Fehler"))
|
||||
End Select
|
||||
End Sub
|
||||
|
||||
Shared Sub sendERRORperMail(title, errmsg, errstack, recieverMailAdress, zusatz)
|
||||
Dim Msg As New MailMessage
|
||||
Dim myCredentials As New System.Net.NetworkCredential
|
||||
myCredentials.UserName = "al@verag.ag"
|
||||
myCredentials.Password = "verag#2"
|
||||
|
||||
Msg.IsBodyHtml = False
|
||||
Dim mySmtpsvr As New SmtpClient()
|
||||
mySmtpsvr.Host = "192.168.0.107" 'bei web.de
|
||||
mySmtpsvr.Port = 25 '587 '25
|
||||
mySmtpsvr.UseDefaultCredentials = False
|
||||
mySmtpsvr.Credentials = myCredentials
|
||||
Try
|
||||
Msg.From = New MailAddress("al@verag.ag")
|
||||
Msg.To.Add(recieverMailAdress)
|
||||
|
||||
Msg.Subject = title '"ERROR - DAKOSY Einarbeitung"
|
||||
Msg.Body = "Uhrzeit: " & Now.ToShortDateString
|
||||
Msg.Body &= vbNewLine
|
||||
Msg.Body &= vbNewLine
|
||||
Msg.Body &= "Fehlermeldung: " & errmsg
|
||||
Msg.Body &= vbNewLine
|
||||
Msg.Body &= vbNewLine
|
||||
Msg.Body &= "Stacktrace: " & errstack
|
||||
Msg.Body &= vbNewLine
|
||||
If zusatz <> "" Then
|
||||
Msg.Body &= "Zusatz: " & zusatz
|
||||
Msg.Body &= vbNewLine
|
||||
End If
|
||||
Msg.Body &= errstack
|
||||
mySmtpsvr.Send(Msg)
|
||||
Catch ex As Exception
|
||||
|
||||
End Try
|
||||
|
||||
End Sub
|
||||
|
||||
End Class
|
||||
|
||||
Public Class ERROR_OP
|
||||
Shared Property SHOW As String = "SHOW"
|
||||
Shared Property MAIL As String = "MAIL"
|
||||
Shared Property TOFILE As String = "TOFILE"
|
||||
End Class
|
||||
Reference in New Issue
Block a user