You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cocoon.apache.org by Nicola Ken Barozzi <ni...@apache.org> on 2002/03/15 18:21:07 UTC

Let's improve (was: Re: Contents of map:handle-errors?)

From: "Peter Robins" <co...@peterrobins.co.uk>

> In my 2.0 setup, I had a map:handle-errors with a simple map:read of an
html
> file. This worked fine. However, with 2.0.1, this no longer compiles.

It shouldn't have compiled; the sitemap checks have become stricter.

>  I
> looked in the documentation (yes, really!): sitemap.html describes
something
> called map:error-handler (I assume this is an, er, error) and says that
>
> "you do not define a generator inside the error handler. Beside this
> issue you configure the error handler like a pipeline. Thus you can choose
> your transformer, and serializer, and all other features of pipeline
> processing"

This is correct.

> If I look in the DTD on the other hand it tells me I can have generators,
> xformers and serializers (sic: what would I do with more than 1
serializer?).
> I tried adding read to the DTD but this had no effect - which didn't
surprise
> me, as afaics the DTD isn't actually used by anything.

Ok, then the DTD is wrong. I'll have to patch it.

> Although read would, istm, be the simplest way of handling page not found
> errors, what I actually want to do is an aggregate, but the compiler
doesn't
> like that either. Nor does it like a redirect or the cocoon:/ protocol.
>
> So, how can I get a handle on this error, and handle without error those
> errors that the handle-errors error-handler won't handle?  ;-)

;-)

You brought out a thing that has been already discussed al lot on
cocoon-dev, but AFAIK we didn't reach a conclusion that satisfies all.

I hope you users can give me some hints on what you want. "Has anyone
arguments against this?" in the following text are the points I would like
to have feedback on.

--------------------------------------------------
 Design decisions on handle-error
--------------------------------------------------

When I made the handle-error pipeline, I thought that it was made to notify
the user of what went wrong.
So I made up a simple DTD for it, and decided to keep it fixed.
[Has anyone arguments against this?]

To prevent misuse of this part of the pipeline that can come if you can
define any Generator in it, I decided to keep the Generator fixed. The user
can then manipulate the error XML to fit any style it needs.
[Has anyone arguments against this?]

There is also a need to access the error contents by actions and selectors.
So I recently changed the works of this internally, and the sitemap model
contains the error notification as an object, enabling it to be used by
actions, selectors, etc.
[Has anyone arguments against this?]

Redirecting in this pipeline could be a problem, since it can redirect to a
pipeline that has an error, which redirects to another one that has an
error, and so on.
[Has anyone arguments against this?]

Using a Reader makes the recursive error problem still possible, since the
Reader can read the pipeline it comes from, or any other pipeline that
generates an error.
[Has anyone arguments against this?]

So, all these decisions mave the error handling what it is today.
Comments, suggestions and constructive criticism is very welcome :-)

So if I get enough feedback, I will modify <handle-errors> to make it more
useful.
[Has anyone arguments against this?]    ;-)

--
Nicola Ken Barozzi                   nicolaken@apache.org
            - verba volant, scripta manent -
   (discussions get forgotten, just code remains)
---------------------------------------------------------------------


---------------------------------------------------------------------
Please check that your question has not already been answered in the
FAQ before posting. <http://xml.apache.org/cocoon/faqs.html>

To unsubscribe, e-mail: <co...@xml.apache.org>
For additional commands, e-mail: <co...@xml.apache.org>


Re: Let's improve (was: Re: Contents of map:handle-errors?)

Posted by Nicola Ken Barozzi <ni...@apache.org>.
From: "Peter Robins" <co...@peterrobins.co.uk>

> For me, the big advantage of
> Cocoon is not the 'separation of concerns', which I've been doing for
years
> with Perl/PHP templating systems, but the sitemap, which provides a clean,
> simple, standardised way of defining processes on the site. If your
sitemap
> matches 404 errors with a read of a page_not_found.html, then it's clear
> what's happening; if you have to look into an xslt script to see what it
> does, then it's not so clear.

Understand. In fact I have already made a Selector that selects the pipeline
to use by selecting on any of the error notification parameters.
Currently we are in code freeze for 2.0.2, so I can't commit it, but be sure
I will tackle this as soon as the release is out.
I'll have also to go round the code and make all errors more descriptive and
make the errors be properly cascaded.

> On Sunday 17 Mar 2002 1:52 pm, Nicola Ken Barozzi wrote:
> > I agree, and I'm working on a FAQBuilder, that gives more helpful
messages
> > based on info from a FAQ.
>
> hmm, sounds interesting
>
> > The Cocoon webapp is a *sample*, not a template.
>
> ah, but I bet most people use it as a template.

I know ;-)

This is why I'm restructuring the samples to make it easier to use them as
templates.
Version 2.0.2 will have the new restructured ones as a WIP.

> Going off at a tangent, in your previous posting, you mentioned correcting
> the sitemap DTD. It would be good if this could be checked against the
actual
> logic and then implemented properly. At the moment, it seems in some
places
> to be incorrect, so can't be used for validating.

Many checks were put in the latest sitemap, and the new TreeProcessor
sitemap is very effective in telling what's wrong.
As for the error handling, it's in a flux for now, since using multiple
"handle-errors" will be deprecated in favor of a Selector used inside.
If there are evident errors in the DTD, please tell me, so I can patch it
before next week's release.

Thank you :-)

--
Nicola Ken Barozzi                   nicolaken@apache.org
            - verba volant, scripta manent -
   (discussions get forgotten, just code remains)
---------------------------------------------------------------------


---------------------------------------------------------------------
Please check that your question has not already been answered in the
FAQ before posting. <http://xml.apache.org/cocoon/faqs.html>

To unsubscribe, e-mail: <co...@xml.apache.org>
For additional commands, e-mail: <co...@xml.apache.org>


Re: Let's improve (was: Re: Contents of map:handle-errors?)

Posted by Peter Robins <co...@peterrobins.co.uk>.
On Sunday 17 Mar 2002 1:52 pm, Nicola Ken Barozzi wrote:
> > In my experience, by far the commonest error is page not found, and by
> > far the commonest cause of that is that the user has mistyped the url (or
> clicked
> > on an incorrect link). So all they need is a simple message saying 'page
> not
> > found, please check what you entered' - a simple read of an html file is
> > surely the simplest way of doing this.
>
> Sure, you can do it.
> Make a stylesheet that outputs only that page in the handle-errors pipeline
> and you're done.

yes, this did occur to me - in effect, have a transformer that ignores the 
output of the generator. However, this loses some transparency in the 
sitemap, as it's not so obvious what's going on. For me, the big advantage of 
Cocoon is not the 'separation of concerns', which I've been doing for years 
with Perl/PHP templating systems, but the sitemap, which provides a clean, 
simple, standardised way of defining processes on the site. If your sitemap 
matches 404 errors with a read of a page_not_found.html, then it's clear 
what's happening; if you have to look into an xslt script to see what it 
does, then it's not so clear. This is the weakness of the Perl/PHP method: 
you have to look into the script/'logicsheet' (read: you have to have a 
programmer around), so it's harder to figure out what's going on.

> I agree, and I'm working on a FAQBuilder, that gives more helpful messages
> based on info from a FAQ.

hmm, sounds interesting

> The Cocoon webapp is a *sample*, not a template.

ah, but I bet most people use it as a template.


Going off at a tangent, in your previous posting, you mentioned correcting 
the sitemap DTD. It would be good if this could be checked against the actual 
logic and then implemented properly. At the moment, it seems in some places 
to be incorrect, so can't be used for validating.

---------------------------------------------------------------------
Please check that your question has not already been answered in the
FAQ before posting. <http://xml.apache.org/cocoon/faqs.html>

To unsubscribe, e-mail: <co...@xml.apache.org>
For additional commands, e-mail: <co...@xml.apache.org>


Re: Let's improve (was: Re: Contents of map:handle-errors?)

Posted by Nicola Ken Barozzi <ni...@apache.org>.
From: "Peter Robins" <co...@peterrobins.co.uk>

> Nicola, istm you are making 2 false assumptions:
> 1. all errors are program errors
> 2. only the people who set up the site use it

No, I don't make these assumptions, really.
1. All errors that are in the defined flow of the session must be handled
*without* handle-errors, which should handle what the developr hasen't
thought of. This is the assumption I have, and it could as well be wrong.
2. Not at all. The sample webapp is for site developers, not meant to be
shoved in production right away. If the site programmers don't take care of
providing nicer error messages, no wonder you have this idea.

> In any properly tested system, internal server errors and the like
shouldn't
> (!) occur.

How I would like it to be true! ;-)

> Even if they do, there is nothing the user can do about it, so
> there's no point in telling them, apart perhaps from a simple message that
> there's a problem - please try again later or whatever. If a user gets a
list
> of exceptions/java classes/whatever comes out of the generator, they won't
> understand a word of it anyway.

True. But what prevents the programmer to making the error more
human-readable?

The error can be fatal or simply an error for example. The Programmer would
like to show two different pages for it. Hence the info of the Exception is
needed.

> The site administrator needs a report, so the
> problem can be fixed, but will get that from the logs.

I prefer to leave this as a choice.
And sometimes, some non-db "transactions" need a rollback on error, like a
mail notification that something has gone wrong, and they may need info on
the kind of error to decide what to tell the user.

> In my experience, by far the commonest error is page not found, and by far
> the commonest cause of that is that the user has mistyped the url (or
clicked
> on an incorrect link). So all they need is a simple message saying 'page
not
> found, please check what you entered' - a simple read of an html file is
> surely the simplest way of doing this.

Sure, you can do it.
Make a stylesheet that outputs only that page in the handle-errors pipeline
and you're done.

> More user-friendly is to give them the
> message together with a standard menu of links to click on, which is why I
> was wanting an aggregate, but I'm not really bothered which map element is
> used to provide the page, whatever makes most sense.
>
> HTH
>
> p.s. if the sitemap compiler could similarly provide a more user-friendly
> message such as 'sitemap won't compile - pls check your xml is valid'
instead
> of inscrutable messages about sitemap handlers, the amount of traffic in
this
> list should decline significantly :-)

:-)

I agree, and I'm working on a FAQBuilder, that gives more helpful messages
based on info from a FAQ.
I hope to commit it soon.

As I've read in also private responses, what the developers are missing is a
simple error page that says something descriptive about the error, with the
possibility of having a more detailed message, and a simple way of showing
an html page.
To be honest, this is already possible in current Cocoon, but it seems that
no developer that uses Cocoon touches the error handling stuff, so I need to
do it for them ;-P

The Cocoon webapp is a *sample*, not a template.

> p.p.s. don't have any arguments against your last point - TIA for any
> improvements

:-)

Thanks for the feedback! :-)

--
Nicola Ken Barozzi                   nicolaken@apache.org
            - verba volant, scripta manent -
   (discussions get forgotten, just code remains)
---------------------------------------------------------------------


---------------------------------------------------------------------
Please check that your question has not already been answered in the
FAQ before posting. <http://xml.apache.org/cocoon/faqs.html>

To unsubscribe, e-mail: <co...@xml.apache.org>
For additional commands, e-mail: <co...@xml.apache.org>


Re: Let's improve (was: Re: Contents of map:handle-errors?)

Posted by Peter Robins <co...@peterrobins.co.uk>.
Nicola, istm you are making 2 false assumptions:
1. all errors are program errors
2. only the people who set up the site use it

In any properly tested system, internal server errors and the like shouldn't 
(!) occur. Even if they do, there is nothing the user can do about it, so 
there's no point in telling them, apart perhaps from a simple message that 
there's a problem - please try again later or whatever. If a user gets a list 
of exceptions/java classes/whatever comes out of the generator, they won't 
understand a word of it anyway. The site administrator needs a report, so the 
problem can be fixed, but will get that from the logs.

In my experience, by far the commonest error is page not found, and by far 
the commonest cause of that is that the user has mistyped the url (or clicked 
on an incorrect link). So all they need is a simple message saying 'page not 
found, please check what you entered' - a simple read of an html file is 
surely the simplest way of doing this. More user-friendly is to give them the 
message together with a standard menu of links to click on, which is why I 
was wanting an aggregate, but I'm not really bothered which map element is 
used to provide the page, whatever makes most sense.

HTH
 
p.s. if the sitemap compiler could similarly provide a more user-friendly 
message such as 'sitemap won't compile - pls check your xml is valid' instead 
of inscrutable messages about sitemap handlers, the amount of traffic in this 
list should decline significantly :-)

p.p.s. don't have any arguments against your last point - TIA for any 
improvements


On Friday 15 Mar 2002 5:21 pm, Nicola Ken Barozzi wrote:
>
> You brought out a thing that has been already discussed al lot on
> cocoon-dev, but AFAIK we didn't reach a conclusion that satisfies all.
>
> I hope you users can give me some hints on what you want. "Has anyone
> arguments against this?" in the following text are the points I would like
> to have feedback on.
>
> --------------------------------------------------
>  Design decisions on handle-error
> --------------------------------------------------
>
> When I made the handle-error pipeline, I thought that it was made to notify
> the user of what went wrong.
> So I made up a simple DTD for it, and decided to keep it fixed.
> [Has anyone arguments against this?]
>
> To prevent misuse of this part of the pipeline that can come if you can
> define any Generator in it, I decided to keep the Generator fixed. The user
> can then manipulate the error XML to fit any style it needs.
> [Has anyone arguments against this?]
>
> There is also a need to access the error contents by actions and selectors.
> So I recently changed the works of this internally, and the sitemap model
> contains the error notification as an object, enabling it to be used by
> actions, selectors, etc.
> [Has anyone arguments against this?]
>
> Redirecting in this pipeline could be a problem, since it can redirect to a
> pipeline that has an error, which redirects to another one that has an
> error, and so on.
> [Has anyone arguments against this?]
>
> Using a Reader makes the recursive error problem still possible, since the
> Reader can read the pipeline it comes from, or any other pipeline that
> generates an error.
> [Has anyone arguments against this?]
>
> So, all these decisions mave the error handling what it is today.
> Comments, suggestions and constructive criticism is very welcome :-)
>
> So if I get enough feedback, I will modify <handle-errors> to make it more
> useful.
> [Has anyone arguments against this?]    ;-)

---------------------------------------------------------------------
Please check that your question has not already been answered in the
FAQ before posting. <http://xml.apache.org/cocoon/faqs.html>

To unsubscribe, e-mail: <co...@xml.apache.org>
For additional commands, e-mail: <co...@xml.apache.org>