[Seaside] Custom WAErrorHandler

Philippe Marschall philippe.marschall at gmail.com
Mon Aug 15 18:54:35 UTC 2011


2011/8/15 Francois Stephany <tulipe.moutarde at gmail.com>:
> I'm playing with WAErrorHandler lately and wonder how can I generate a clean
> response from it.
>
> For example:
>
> GTRootComponent>>renderContentOn: html
>  self renderLoginTabOn: html.
>  self renderSocialLinksOn: html.
>  self renderMainContentOn: html.
>  Dictionary new at: #blop.
>  self renderFooterOn: html.
>
> My custom handler looks like this:
>
> handleDefault: anException
>  | content answer |
>  self sendFailFor: anException.
>  anException isResumable
>    ifTrue: [ anException resume ].
>
>  content := WAHtmlCanvas builder
>    fullDocument: true;
>    rootBlock: [ :root | root title: 'Unable to proceed' ];
>      render: [ :html | html heading level: 1; with: 'Error !' ].
>    self requestContext respond: [ :response |
>      response
>        internalError;
>        nextPutAll: content ]
>
> The handler handles the KeyNotFound fine but the response is already filled
> with the rendering of renderLoginTabOn:, renderSocialLinksOn: and
> renderMainContentOn:.
>
> Is there a way to draw on a clean response ? I guess it's pretty obvious,
> I've looked at the requestContext and responseGenerator but cannot find  how
> to do it :/

Are you using a streaming server (eg. WAListenerAdaptor)?

Cheers
Philippe


More information about the seaside mailing list