Knowledgebase: EurekaLog V7
7.x: EurekaLog is not called when I have Application.OnException event assigned
Posted by Aleksandr Alekseev on 26 October 2012 10:48

Problem:

I have old code, which is working fine with previous version of EurekaLog (5.x/6.x). It does not work with EurekaLog 7. I set all options as outlined in guides, but EurekaLog is not invoked automatically for exceptions. My code assigns Application.OnException handler.

Reason:

Previous EurekaLog versions ignored whenever Application.OnException event was set or not. This behavious conflicted with default behaviour of Application object.

EurekaLog 7 changes the way to work with Application.OnException event. EurekaLog 7 respects this event: if event handler is NOT set - then EurekaLog will handle exceptions automatically; if event handler is set - then EurekaLog assumes that you want to handle exceptions by yourself.

Solution:

That depends on what you want.

  1. If you want EurekaLog to handle exception - you don't need Application.OnException handler. Just remove it:
    1. You can use {$IFDEF EUREKALOG} or EBase.IsEurekaLogActive to determinate if you need to install Application.OnException or not. You can install your own handler for Application.OnException when you compile application without EurekaLog.
    2. You can move your code to OnExceptionNotify handler.
  2. If you want to run your custom code for each exception - then you can keep your handler:
    1. You can call EExceptionManager.ExceptionManager.ShowLastExceptionData inside your Application.OnException handler to invoke EurekaLog's processing for current exception.
    2. You can move your code to OnExceptionNotify handler and use AHandle argument to switch between EurekaLog's processing and your code.

See also:


Help Desk Software by Kayako Resolve