Custom WAErrorHandler

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
7 messages Options
Reply | Threaded
Open this post in threaded view
|

Custom WAErrorHandler

fstephany
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 :/

Cheers,

Francois
_______________________________________________
seaside mailing list
[hidden email]
http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
Reply | Threaded
Open this post in threaded view
|

Re: Custom WAErrorHandler

Philippe Marschall
2011/8/15 Francois Stephany <[hidden email]>:

> 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
_______________________________________________
seaside mailing list
[hidden email]
http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
Reply | Threaded
Open this post in threaded view
|

Re: Custom WAErrorHandler

fstephany

>>
>> 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)?

Hi Philippe, sorry for the late reply :/
I'm using ZnZincServerAdaptor
_______________________________________________
seaside mailing list
[hidden email]
http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
Reply | Threaded
Open this post in threaded view
|

Re: Custom WAErrorHandler

Philippe Marschall
2011/8/18 Francois Stephany <[hidden email]>:

>
>>>
>>> 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)?
>
> Hi Philippe, sorry for the late reply :/
> I'm using ZnZincServerAdaptor

Uh oh, you found a bug [1]. You'll have to add a

response stream reset

and will probably have to add this method on GRCodecStream and
delegate to the stream instance variable.

 [1] http://code.google.com/p/seaside/issues/detail?id=676

Cheers
Philippe
_______________________________________________
seaside mailing list
[hidden email]
http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
Reply | Threaded
Open this post in threaded view
|

Re: Custom WAErrorHandler

fstephany

>>>> 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)?
>>
>> Hi Philippe, sorry for the late reply :/
>> I'm using ZnZincServerAdaptor
>
> Uh oh, you found a bug [1]. You'll have to add a
>
> response stream reset
>
> and will probably have to add this method on GRCodecStream and
> delegate to the stream instance variable.
>
>   [1] http://code.google.com/p/seaside/issues/detail?id=676

Cheers ! I'll test that, should I commit something somewhere ?
_______________________________________________
seaside mailing list
[hidden email]
http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
Reply | Threaded
Open this post in threaded view
|

Re: Custom WAErrorHandler

Philippe Marschall
2011/8/18 Francois Stephany <[hidden email]>:

>
>>>>> 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)?
>>>
>>> Hi Philippe, sorry for the late reply :/
>>> I'm using ZnZincServerAdaptor
>>
>> Uh oh, you found a bug [1]. You'll have to add a
>>
>> response stream reset
>>
>> and will probably have to add this method on GRCodecStream and
>> delegate to the stream instance variable.
>>
>>  [1] http://code.google.com/p/seaside/issues/detail?id=676
>
> Cheers ! I'll test that, should I commit something somewhere ?

No, we'll fix.

Cheers
Philippe
_______________________________________________
seaside mailing list
[hidden email]
http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
Reply | Threaded
Open this post in threaded view
|

Re: Custom WAErrorHandler

fstephany
>>> Uh oh, you found a bug [1]. You'll have to add a
>>>
>>> response stream reset
>>>
>>> and will probably have to add this method on GRCodecStream and
>>> delegate to the stream instance variable.
>>>
>>>   [1] http://code.google.com/p/seaside/issues/detail?id=676
>>
>> Cheers ! I'll test that, should I commit something somewhere ?
>
> No, we'll fix.

Ok, thanks !
_______________________________________________
seaside mailing list
[hidden email]
http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside