[Seaside] Exceptions handling

David Shaffer cdshaffer at acm.org
Tue Mar 22 18:31:23 CET 2005

Andrei N.Sobchuck wrote:

>I'm exploring seaside/VW. 
>How ensure/ifCurtailed work in seaside/VW?
>WAClosureTest on 'go with ensure' prints:
>'a 1' 'ensure' 
>'b 2' 'ensure' 
>'c 3' 'ensure'
>Is that right?

I'll let Avi address this.  I think it's fine...

>I implemented the following code:
>  submitButtonWithAction: 
>    [[1/0] ensure: [Transcript show: 'err'; cr]] 
>  text: 'tst'
>#ensure: block is executed only if 'debug' link is pressed. 
>I wonder why #ensure: block is called 4 times in 1st case
>and only 1 time in second?
I think this behavior can be expected since Seaside wraps your callback 
handling in an error handler.  So, in non-deployment mode you have the 
equivalent of this:

[ [1/0] ensure: [Transcript show: 'err1'; cr] ] on: Error do: [:ex | 
Transcript show: 'err2'; cr]

Notice that err2 prints first.  That's basically what you're seeing in 
Seaside. Tthe equivalent of show: 'err2' is that the Seaside error 
handler, WAWalkbackErrorHandler, is starting a new render loop to render 
the stack trace page.  Basically you are still inside the do: argument 
block until you debug the app.  Then you exit that block and ensure: 
does its work.  My guess (completely untested) is that if you switch to 
deployment mode you'll see your ensure block run as expected.


More information about the Seaside mailing list