Re: Passing parameters to HandleException

Tech-Archive recommends: Repair Windows Errors & Optimize Windows Performance



Yes, Nick

I see your point.

I want to enjoy the app block library, but I also want to pass a param
that will enable my programmers to send their own message to my logging
system.
I guess I will probably implement my own Exception class that will be
inherited from exception, and include their option to add customized
messages to the Exception Handler, when I will probably cast them back
using inner Exception.

Gil.


Nick Malik [Microsoft] wrote:
> what would be the point of creating an implementation of a type if you don't
> intend to keep the same interface?
>
> The entire point of the Liskov Substitution Principle is that the framework
> (the Exception Handling Application Block) is not aware of which of the
> exception handlers it is using. They all have to behave in the same way.
> That includes yours.
>
> I haven't studied the block in detail. I assume that the ExceptionPolicy
> object provides the static call to HandleException. If so, you are using
> someone elses code to call yours. To do so, you have to conform to the
> interface imposed by that code.
>
> Do you see what I'm getting at?
>
> --
> --- Nick Malik [Microsoft]
> MCSD, CFPS, Certified Scrummaster
> http://blogs.msdn.com/nickmalik
>
> Disclaimer: Opinions expressed in this forum are my own, and not
> representative of my employer.
> I do not answer questions on behalf of my employer. I'm just a
> programmer helping programmers.
> --
> "Gil" <gil@xxxxxxxxxxx> wrote in message
> news:1121862656.166265.206260@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
> > Hi All.
> >
> > I am testing Microsoft Enterprise Library - June 2005 Exception
> > Handling, and I am trying to pass parameters to HandleException Method,
> > and recieve it in my implementation of the abstract class.
> > However, it seems that the HandleException can only implement:
> >
> > public abstract Exception HandleException(
> > Exception exception,
> > string policyName,
> > Guid handlingInstanceId
> > And that you can not add your own override implementation.
> >
> > Does some one knows if this doable and how ?
> >
> > What I tried to do is to implement the HandleException by adding more
> > parameters after the GUID parameter. The problem is that it would not
> > compile.
> >
> > Example
> >
> > void func(string strData)
> > {
> > try
> > {
> > ...
> > }
> > catch(Exception e)
> > {
> > ExceptionPolicy.HandleException(e,"DAL",strData);
> > }
> > }
> >

.



Relevant Pages

  • Re: Rationale behind unwind-protect and double errors
    ... try/finally exception handling system. ... C++ programmers usually use destructors for the same purpose. ... handling, which does not use the mechanism you outline. ...
    (comp.lang.lisp)
  • Re: Tasty exceptions
    ... to report non-critical errors. ... That's a major part of what we have been trying to get you to understand - you should not be handling exceptions everywhere! ... intellectual your error handling strategy seems to make perfect since for certain programmers. ... and, in that case, exception handling just don't work well from that perspective. ...
    (borland.public.delphi.non-technical)
  • Re: Passing parameters to HandleException
    ... (the Exception Handling Application Block) ... interface imposed by that code. ... > Handling, and I am trying to pass parameters to HandleException Method, ...
    (microsoft.public.dotnet.framework)
  • Passing parameters to HandleException
    ... I am testing Microsoft Enterprise Library - June 2005 Exception ... Handling, and I am trying to pass parameters to HandleException Method, ... Guid handlingInstanceId ...
    (microsoft.public.dotnet.framework)
  • Find the difference :)
    ... HandleException; ... Let's see in Example1: ... if Connection.Open raises an exception then ... IT S BETTER TO ALWAYS TRY TO CLOSE THE CONNECTION THAN NOT AT ALL ...
    (alt.comp.lang.borland-delphi)