[Seaside] [VW] Using exception catching confuses Seaside?

Lukas Renggli renggli at gmail.com
Sat Aug 19 18:09:07 UTC 2006


>         MyTask>>go
>             [ "do application stuff" ]
>                 on: Exception do: [ :ex | "whatever" ]

Short answer: Don't use Exception, but its subclass Error.

Long answer: You code also catches all the Notifications raised by
Seaside for different purposes and that are required to do the request
processing.

Solution: It is considered bad style to catch all kind of exceptions
within a single hander. Use #on:do: with more specific exceptions,
that works well with Seaside. If you need a specific error handler
customize a subclass of WAErrorHandler and use this one within your
application.

>         MyTask>>go
>             [ "do application stuff" ]
>                 ensure: [ "close database connections" ]

Short answer: Continuations don't go well together with #ensure: (ask Google).

Long answer: If you have different #call: statements within the
receiver of #ensure: the system cannot know when to evaluate the
argument of the #ensure: block. The user can always press the back
button of the browser and go back into the receiving block.

Solutions: Put your connection into a custom WASession class and close
it when the session is garbage collected. Or use a connection pool and
fetch a new connection for every request.

Cheers,
Lukas

-- 
Lukas Renggli
http://www.lukas-renggli.ch


More information about the Seaside mailing list