|
In this example, we're going to intercept the exceptions and test, if it is a null object exception, we're going to display a message, and we'll stop the exception from reaching the reporting service.
If it is an unexpected exception, we let EurekaLog handle it.
C# example:
private void eurekaLog1_ExceptionNotify(Exception Error, EurekaLogSystem.EurekaLogOptions Options, ref bool Handled)
{
if (Error is NullReferenceException)
{
MessageBox.Show("Ooopps, someone forgot to create a new instance of that object.");
//handled == false means that EurekaLog shouldn't handle this exception. True is default.
Handled = false;
}
else
//here we don't change the handled ref, because we want EurekaLog to display the error dialog.
MessageBox.Show("I really don't know what's the problem. Honest");
}
|
Visual Basic example:
Private Sub EurekaLog1_ExceptionNotify(ByVal [Error] As System.Exception, ByVal Options As EurekaLogSystem.EurekaLogOptions, ByRef Handled As System.Boolean) Handles EurekaLog1.ExceptionNotify
If TypeOf [Error] Is NullReferenceException Then
MessageBox.Show("Ooopps, someone forgot to create a new instance of that object.")
Handled = False 'handled == false means that EurekaLog shouldn't handle this exception. True is default.
Else
MessageBox.Show("I really don't know what's the problem. Honest") 'here we don't change the handled ref, because we want EurekaLog to display the error dialog.
End If
End Sub
|
|