PDA

View Full Version : Enhanced notification model with ExceptionClass Filter


news.combit.net
17-Aug-2005, 03:07 PM
Hi Fabio,

we now have buyed EurekaLog 5 and it is really nice to work with it. But we
have some suggestions we would like to ask you to implement because it is a
feature that could be interesting for all EurekaLog users, otherwise we will
implement our own notification handling.

1. Exception Class Filter for TEurekaLog
I use TEurekaLog Component (created and destroyed in
initialization/finalization part) in my Reporting Framework Unit that I use
in many projects, to catch the specific report designer exceptions with my
Exception filter (TEurekaLog Component). Now the problem is, that there is
no way to enforce, that:
- only this ExceptionNotiy is fired for the specified Exception class.
- to interrupt EurekaLog to not notify other TEurekaLog components.

Therefore the following feature would be very mighty:

1. New ExceptionClass Property to assign an Exception Class in the
TEurekaLog Component.

2. If the ExceptionClass Property is Assigned, then the handlers are only
notified, when the exception class of the current exception matches the
ExceptionClass Property.

3. If an OnExceptionNotify handler is notified, it should be possible to
prevent notifying the other TEurekaLog Components.

4. While EurekaLog iterates from EurekaLogList.Count -1 downto 0 the sort
order of the EurekaLogList is relevant. Because all TEurekaLog Components
with assigned ExceptionClass property should be handled before the the
components with an unassigned ExceptionClass property. This would guarantee,
that the Components are notified in the correct order regardless from there
creation order (resort the EurekaLogList when a ExceptionClass property has
changed).

Example:

procedure CallExceptionNotify;
var
n: Integer;
continueNotify: Boolean;
begin
for n := EurekaLogList.Count - 1 downto 0 do begin
if (Assigned(EurekaLogList[n].OnExceptionNotify))
and (not Assigned(EurekaLogList[n].Filter) or
(Global_ExceptionRecord.ExceptionObject is
EurekaLogList[n].ExceptionClass)
then
EurekaLogList[n].OnExceptionNotify(Global_ExceptionRecord,
Global_Handled,continueNotify);
If not continueNotify then Break;
if (Assigned(ExceptionNotify)) then
ExceptionNotify(Global_ExceptionRecord, Global_Handled); end;

Best Regards,
Michael

admin
17-Aug-2005, 04:22 PM
news.combit.net wrote:

> Hi Fabio,
>
> we now have buyed EurekaLog 5 and it is really nice to work with it. But we
> have some suggestions we would like to ask you to implement because it is a
> feature that could be interesting for all EurekaLog users, otherwise we will
> implement our own notification handling.
>
> [...]
>
> Therefore the following feature would be very mighty:
>
> 1. New ExceptionClass Property to assign an Exception Class in the
> TEurekaLog Component.
>
> 2. If the ExceptionClass Property is Assigned, then the handlers are only
> notified, when the exception class of the current exception matches the
> ExceptionClass Property.
>
> 3. If an OnExceptionNotify handler is notified, it should be possible to
> prevent notifying the other TEurekaLog Components.
>
> [...]
>
> Best Regards,
> Michael

It's a really good suggestion.
I think to implement a similar feature in the next versions.

At this time to obtain a similar behavior you can use an ExceptionNotify
event like this:

------------------------------------------------------------------
uses
ExceptionLog, ECore, ETypes; // The required units...

// This is a normal procedure (not a method)...
procedure MyNotify(ExcRecord: TEurekaExceptionRecord;
var Handled: Boolean);
begin
if (ExcRecord.ExceptionObject is ExceptionType1) then
begin
// Your code here...
end
else
if (ExcRecord.ExceptionObject is ExceptionType2) then
begin
// Your code here...
end
else ... // Other exceptions types...
end;
------------------------------------------------------------------

--
Best regards...

Fabio Dell'Aria.

Michael Seelig
17-Aug-2005, 11:18 PM
> At this time to obtain a similar behavior you can use an ExceptionNotify
> event like this:
>
> ------------------------------------------------------------------
> uses
> ExceptionLog, ECore, ETypes; // The required units...
>
> // This is a normal procedure (not a method)...
> procedure MyNotify(ExcRecord: TEurekaExceptionRecord;
> var Handled: Boolean);
> begin
> if (ExcRecord.ExceptionObject is ExceptionType1) then
> begin
> // Your code here...
> end
> else
> if (ExcRecord.ExceptionObject is ExceptionType2) then
> begin
> // Your code here...
> end
> else ... // Other exceptions types...
> end;
> ------------------------------------------------------------------
>

This sample is ok when you have a centralized ExceptionNotify Handler.
But we have our different frameworks we implement in delphi. This frameworks
we include in a modulare way in our projects (examples: database access with
archive/history funcionality framework, generic reporting tool with
designer). So this frameworks have there own/different Exception handling
logic. If one of our developer would build a new application he will use the
frameworks "as is", without implementing a customized centralized
ExceptionNotify event which takes car for all kinds of exception handling
needed by the different frameworks.

But I'm quite happy to hear that you will enhance EurekaLog with a similar
feature!

Best Regards,
Michael

admin
18-Aug-2005, 10:00 AM
Michael Seelig wrote:
>>At this time to obtain a similar behavior you can use an ExceptionNotify
>>event like this:
>>
>>------------------------------------------------------------------
>>uses
>> ExceptionLog, ECore, ETypes; // The required units...
>>
>>// This is a normal procedure (not a method)...
>>procedure MyNotify(ExcRecord: TEurekaExceptionRecord;
>> var Handled: Boolean);
>>begin
>> if (ExcRecord.ExceptionObject is ExceptionType1) then
>> begin
>> // Your code here...
>> end
>> else
>> if (ExcRecord.ExceptionObject is ExceptionType2) then
>> begin
>> // Your code here...
>> end
>> else ... // Other exceptions types...
>>end;
>>------------------------------------------------------------------
>>
>
>
> This sample is ok when you have a centralized ExceptionNotify Handler.
> But we have our different frameworks we implement in delphi. This frameworks
> we include in a modulare way in our projects (examples: database access with
> archive/history funcionality framework, generic reporting tool with
> designer). So this frameworks have there own/different Exception handling
> logic. If one of our developer would build a new application he will use the
> frameworks "as is", without implementing a customized centralized
> ExceptionNotify event which takes car for all kinds of exception handling
> needed by the different frameworks.
>
> But I'm quite happy to hear that you will enhance EurekaLog with a similar
> feature!
>
> Best Regards,
> Michael

Yes it's true.
Your problem is solvable only with the new feature (coming soon)! :)

--
Best regards...

Fabio Dell'Aria.