Unhandled Exceptions in a Plugin
Is there a way either with some plugin code or setting to get Jiwa to log any unhandled exceptions in a plugin to say the application log rather than just getting the message box of the error?
Dim currentDomain As AppDomain = AppDomain.CurrentDomain
AddHandler currentDomain.UnhandledException, AddressOf UnhandledExceptionHandler
AddHandler System.Windows.Forms.Application.ThreadException, AddressOf UnhandledFormExceptionHandlerPrivate 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 SubAppDomain currentDomain = AppDomain.CurrentDomain;
currentDomain.UnhandledException += PluginUnhandledExceptionHandler;
System.Windows.Forms.Application.ThreadException += PluginUnhandledFormExceptionHandler;