Sylvain Wallez wrote:
> >>But why throwing a ProcessingException ? Simply throwing Exception would
> >>avoid exception cascading (I hate these never ending stacktraces) and
> >>better cope with the variety of implementations.
> >>
> >>
> >>
> >Valid question...now the question is: where do you want to handle the
> >exception?
> >
>
> Back to the exception handling stragegy ;-)
>
Yuppy!

> AFAIK, exceptions are handled in Cocoon in two places : in
> <map:handle-errors> and in CocoonServlet. As discussed recently,
> everywhere else they should just be propagated. And propagating means
> cascading if the exception you catch doesn't match one of the exception
> types you're declaring to throw.
>
> Now what is the semantic added value of "ProcessingException" compared
> to "Exception" ? The javadoc states "This exception is thrown every time
> there is a problem in processing a request". And Cocoon does nothing
> else than processing a request !
>
> So ProcessingException doesn't IMHO bring much more information than a
> standard Exception. The only added value is that ProcessingException
> _should_ be an indication of where the problem occured, and in that case
> its use should be reserved to pipeline-related classes. If you look at
> Pipeline and Generator, they do throw a ProcessingException. Action does
> not and throws an Exception.
>
> All this to say that I don't like much this ProcessingException that
> doesn't say much and often forces cascading :-)
>
But if you have a method indicating that it throws a ProcessingException
and it calls a method which simply throws Exception than you have to
do something like this:
try {
    inputmodule.method();
} catch (ProcessingException pe) {
    // rethrow
    throw pe;
} catch (Exception e) {
    throw new ProcessingException(e);
}

And there are some important (= high level) classes which indicate
to throw ProcessingException - that's all.

Apart from that just Exception is too specific for me, but I guess
that's my personal problem here.

Ok, you say "Exception", I say "ProcessingException" - the next one
in this thread apart from us two can decide which one to use :)

Carsten


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, email: [EMAIL PROTECTED]

Reply via email to