Dim currentDomain As AppDomain = AppDomain.CurrentDomain
AddHandler currentDomain.UnhandledException, AddressOf UnhandledExceptionHandler
AddHandler System.Windows.Forms.Application.ThreadException, AddressOf UnhandledFormExceptionHandler
Private Sub UnhandledExceptionHandler(ByVal sender As Object, ByVal e As UnhandledExceptionEventArgs)
If TypeOf e.ExceptionObject IsNot JiwaApplication.Exceptions.ClientCancelledException Then
If DirectCast(e.ExceptionObject, System.Exception).Data.Contains("Custom Message") Then
ReportError(DirectCast(e.ExceptionObject, System.Exception).Data("Custom Message"), DirectCast(e.ExceptionObject, System.Exception).GetBaseException.TargetSite.Name)
Else
ReportError(DirectCast(e.ExceptionObject, System.Exception).GetBaseException.Message, DirectCast(e.ExceptionObject, System.Exception).GetBaseException.TargetSite.Name)
End If
End If
End Sub
Private Sub UnhandledFormExceptionHandler(ByVal sender As Object, ByVal e As Threading.ThreadExceptionEventArgs)
If TypeOf e.Exception IsNot JiwaApplication.Exceptions.ClientCancelledException Then
If e.Exception.Data.Contains("Custom Message") Then
ReportError(e.Exception.Data("Custom Message"), e.Exception.GetBaseException.TargetSite.Name)
Else
ReportError(e.Exception.GetBaseException.Message, e.Exception.GetBaseException.TargetSite.Name)
End If
End If
End Sub
AppDomain currentDomain = AppDomain.CurrentDomain;
currentDomain.UnhandledException += PluginUnhandledExceptionHandler;
System.Windows.Forms.Application.ThreadException += PluginUnhandledFormExceptionHandler;
Return to Technical and or Programming
Users browsing this forum: No registered users and 11 guests