You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@cocoon.apache.org by Stefano Mazzocchi <st...@apache.org> on 2003/11/01 01:32:40 UTC

[bug?] exception thrown in sendPage() skips the proper error handler

I'm still having fun with webdavapps and found something that looks 
suspiciously close to a bug in the way the flow and sitemap work 
together in case of an exception.

In the davmap, I added

     <map:handle-errors>
       <map:read src="error.html" mime-type="text/html" 
status-code="404"/>
     </map:handle-errors>

to handle all errors in the fastest and simplest possible way but if 
the error is triggered in a pipeline call from the flowscript, for 
example, in the davmap case

   function selectMethod() {
     var page = cocoon.parameters["page"];
     var method = cocoon.request.getMethod();
     cocoon.sendPage(method+"/"+page, null);
   }

then my error handler is skipped and the normal error page is presented.

I think this behavior is wrong: the flow is just a way to add scripting 
in the sitemap without hardcoding it in, but the call scope should be 
preserved, even for exceptions.

WDYT?

--
Stefano.


Re: [bug?] exception thrown in sendPage() skips the proper error handler

Posted by Stefano Mazzocchi <st...@apache.org>.
On Saturday, Nov 1, 2003, at 19:27 Europe/Rome, Sylvain Wallez wrote:

> Stefano Mazzocchi wrote:
>
>>
>> On Saturday, Nov 1, 2003, at 12:09 Europe/Rome, Guido Casper wrote:
>>
>>> See also:
>>> http://marc.theaimsgroup.com/?t=106313753000002&r=1&w=2
>>
>>
>> Great, so it's a bug.
>>
>> What's the status of this? has it been filed on bugzilla yet?
>>
>> Sylvain, any suggestions on how to fix it as Vadim proposed?
>
>
> ?? IIRC, I fixed it as indicated...
>
> Can you expand on the problem, i.e. post relevant snippets that show 
> which error handler is called in which circumstances.

go into the "webdav" block into the "davmap" folder and look at the 
sitemap.

suppose you get a request "GET repo/whatever HTTP/1.1", the following 
matcher is executed

       <map:match pattern="repo/**">
         <map:call function="selectMethod">
           <map:parameter name="page" value="{1}"/>
         </map:call>
       </map:match>

calling this function in "webdav.js"

function selectMethod() {
   var page = cocoon.parameters["page"];
   var method = cocoon.request.getMethod();
   print(method + " " + page);
   cocoon.sendPage(method+"/"+page, null);
}

[print was added by me to see if I reached there] which goes back to 
the sitemap as [simplified by me now for readability]

       <map:match pattern="GET/**">
         <map:match pattern="GET/**.*">
           <map:generate src="{1}.{2}"/>
           <map:serialize type="xml"/>
         </map:match>
         <map:generate type="traverse" src="{1}">
           <map:parameter name="depth" value="1"/>
         </map:generate>
         <map:transform src="styles/collection2html.xsl"/>
         <map:serialize type="html"/>
       </map:match>

       <map:handle-errors>
         <map:read src="error.html" mime-type="text/html" 
status-code="404"/>
       </map:handle-errors>

where "error.html" is my own error page (very simple, almost empty).

If the page is not found, this error handler is not invoked, but it 
falls back on the root sitemap's one.

Either I'm missing something, or it's a bug.

--
Stefano.


Re: [bug?] exception thrown in sendPage() skips the proper error handler

Posted by Sylvain Wallez <sy...@apache.org>.
Stefano Mazzocchi wrote:

>
> On Saturday, Nov 1, 2003, at 12:09 Europe/Rome, Guido Casper wrote:
>
>> See also:
>> http://marc.theaimsgroup.com/?t=106313753000002&r=1&w=2
>
>
> Great, so it's a bug.
>
> What's the status of this? has it been filed on bugzilla yet?
>
> Sylvain, any suggestions on how to fix it as Vadim proposed?


?? IIRC, I fixed it as indicated...

Can you expand on the problem, i.e. post relevant snippets that show 
which error handler is called in which circumstances.

Sylvain

-- 
Sylvain Wallez                                  Anyware Technologies
http://www.apache.org/~sylvain           http://www.anyware-tech.com
{ XML, Java, Cocoon, OpenSource }*{ Training, Consulting, Projects }
Orixo, the opensource XML business alliance  -  http://www.orixo.com



Re: [bug?] exception thrown in sendPage() skips the proper error handler

Posted by Stefano Mazzocchi <st...@apache.org>.
On Saturday, Nov 1, 2003, at 12:09 Europe/Rome, Guido Casper wrote:

> See also:
> http://marc.theaimsgroup.com/?t=106313753000002&r=1&w=2

Great, so it's a bug.

What's the status of this? has it been filed on bugzilla yet?

Sylvain, any suggestions on how to fix it as Vadim proposed?

--
Stefano.


Re: [bug?] exception thrown in sendPage() skips the proper error handler

Posted by Guido Casper <gc...@s-und-n.de>.
See also:
http://marc.theaimsgroup.com/?t=106313753000002&r=1&w=2

Guido

Stefano Mazzocchi <st...@apache.org> wrote:
> I'm still having fun with webdavapps and found something that looks
> suspiciously close to a bug in the way the flow and sitemap work
> together in case of an exception.
> 
> In the davmap, I added
> 
>      <map:handle-errors>
>        <map:read src="error.html" mime-type="text/html"
> status-code="404"/>
>      </map:handle-errors>
> 
> to handle all errors in the fastest and simplest possible way but if
> the error is triggered in a pipeline call from the flowscript, for
> example, in the davmap case
> 
>    function selectMethod() {
>      var page = cocoon.parameters["page"];
>      var method = cocoon.request.getMethod();
>      cocoon.sendPage(method+"/"+page, null);
>    }
> 
> then my error handler is skipped and the normal error page is
> presented. 
> 
> I think this behavior is wrong: the flow is just a way to add
> scripting in the sitemap without hardcoding it in, but the call scope
> should be preserved, even for exceptions.
> 
> WDYT?


RE: [bug?] exception thrown in sendPage() skips the proper error handler

Posted by Reinhard Poetz <re...@apache.org>.
From: Stefano Mazzocchi

> I'm still having fun with webdavapps and found something that looks 
> suspiciously close to a bug in the way the flow and sitemap work 
> together in case of an exception.
> 
> In the davmap, I added
> 
>      <map:handle-errors>
>        <map:read src="error.html" mime-type="text/html" 
> status-code="404"/>
>      </map:handle-errors>
> 
> to handle all errors in the fastest and simplest possible way but if 
> the error is triggered in a pipeline call from the flowscript, for 
> example, in the davmap case
> 
>    function selectMethod() {
>      var page = cocoon.parameters["page"];
>      var method = cocoon.request.getMethod();
>      cocoon.sendPage(method+"/"+page, null);
>    }
> 
> then my error handler is skipped and the normal error page is 
> presented.
> 
> I think this behavior is wrong: the flow is just a way to add 
> scripting 
> in the sitemap without hardcoding it in, but the call scope should be 
> preserved, even for exceptions.
> 
> WDYT?

Checkout http://marc.theaimsgroup.com/?t=106313753000002&r=1&w=2 - there
are some explanations by Sylvain.

Reinhard