SpExceptionContext and error handling

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

SpExceptionContext and error handling

Lautaro Fernández
Hi list, just a thought on the Swazoo port in VisualWorks:

In the class SpExceptionContext the message "for: aBlock onAnyExceptionDo: exceptionBlock" check for Exception errors level, when in VisualWorks I'd say it should ckeck Error errors level.

I saw it because I'm porting Seaside 2.8 from Swazoo 1.0 to Swazoo 2.1, and I couldn't see any CSS, or JS when the pages were rendered. So, debuggin I figured out that "HTTPConnection>>produceResponseFor: aSwazooTask" uses the "for:onAnyExceptionDo:", and that message checks for any kind of exception (Exception class), but under VW you can have exceptions (see Notification class) just to notify something.

The Notification class comment says:
"Superclass for information only exceptions. Unlike most Exceptions, the defaultAction does not raise an UnhandledException, but answers the #defaultResumeValue."

And in my particular case, the problem was with WACurrentSession, which is a subclass of Notification.

Possible solution:
Changing the class to Error instead of Exception in the "SpExceptionContext>>for:onAnyExceptionDo:".

If I'm wrong, please tell me :)

That's all. Hope this helps someone.
Bye
Lautaro Fernández

--
Luke LAut SkyFernadezWalker
Reply | Threaded
Open this post in threaded view
|

Re: SpExceptionContext and error handling

Bruce Badger
2008/6/19 Lautaro Fernández <[hidden email]>:
> In the class SpExceptionContext the message "for: aBlock onAnyExceptionDo:
> exceptionBlock" check for Exception errors level, when in VisualWorks I'd
> say it should ckeck Error errors level.

If you only want to check for errors this should be done in the HTTP
server,as in the Hyper branch.

The onAnyException name is intention revealing - it means *any*
exception, and this is important in particular when Sport is used in
GemStone.

Sport is implemented in many dialects, so changing the semantics of
Sport may well cause problems outside Squeak and VW.

Hope that helps :-)

All the  best,
    Bruce
--
Make the most of your skills - with OpenSkills
http://www.openskills.org/
Reply | Threaded
Open this post in threaded view
|

Re: SpExceptionContext and error handling

Philippe Marschall
In reply to this post by Lautaro Fernández
It's exactly the same problem on Squeak it you at the Squeak code,
you'll see it handles WADynamicVariable specially.

Cheers
Philippe

2008/6/19, Lautaro Fernández <[hidden email]>:

> Hi list, just a thought on the Swazoo port in VisualWorks:
>
> In the class SpExceptionContext the message "for: aBlock onAnyExceptionDo:
> exceptionBlock" check for Exception errors level, when in VisualWorks I'd
> say it should ckeck Error errors level.
>
> I saw it because I'm porting Seaside 2.8 from Swazoo 1.0 to Swazoo 2.1, and
> I couldn't see any CSS, or JS when the pages were rendered. So, debuggin I
> figured out that "HTTPConnection>>produceResponseFor:
> aSwazooTask" uses the "for:onAnyExceptionDo:", and that message checks for
> any kind of exception (Exception class), but under VW you can have
> exceptions (see Notification class) just to notify something.
>
> The Notification class comment says:
> > "Superclass for information only exceptions. Unlike most Exceptions, the
> defaultAction does not raise an UnhandledException, but answers the
> #defaultResumeValue."
> >
>
> And in my particular case, the problem was with WACurrentSession, which is a
> subclass of Notification.
>
> Possible solution:
> Changing the class to Error instead of Exception in the
> "SpExceptionContext>>for:onAnyExceptionDo:".
>
> If I'm wrong, please tell me :)
>
> That's all. Hope this helps someone.
> Bye
> Lautaro Fernández
>
> --
> Luke LAut SkyFernadezWalker
> -------------------------------------------------------------------------
>  Check out the new SourceForge.net Marketplace.
>  It's the best place to buy or sell services for
>  just about anything Open Source.
>  http://sourceforge.net/services/buy/index.php
> _______________________________________________
>  Swazoo-devel mailing list
>  [hidden email]
>  https://lists.sourceforge.net/lists/listinfo/swazoo-devel
>
>
Reply | Threaded
Open this post in threaded view
|

Re: SpExceptionContext and error handling

Bruce Badger
2008/6/20 Philippe Marschall <[hidden email]>:
> It's exactly the same problem on Squeak it you at the Squeak code,
> you'll see it handles WADynamicVariable specially.

You can use Hyper in Squeak too, if you like :-)  ... or you can
modify the branch of the Swazoo HTTP server you are using, or you
could propose adding an explicit >>onAllErrorsDo: to Sport.

What would not be a good is modifying the behavior of the existing
Sport code because so many things running in so many dialects rely on
it in it's current form.

All the best,
    Bruce
--
Make the most of your skills - with OpenSkills
http://www.openskills.org/


Reply | Threaded
Open this post in threaded view
|

Re: SpExceptionContext and error handling

Philippe Marschall
2008/6/20 Bruce Badger <[hidden email]>:
> 2008/6/20 Philippe Marschall <[hidden email]>:
>> It's exactly the same problem on Squeak it you at the Squeak code,
>> you'll see it handles WADynamicVariable specially.
>
> You can use Hyper in Squeak too, if you like :-)

Last time I checked Hyper wasn't available for Squeak.

>  ... or you can
> modify the branch of the Swazoo HTTP server you are using, or you
> could propose adding an explicit >>onAllErrorsDo: to Sport.

I will not monkey-patch!

> What would not be a good is modifying the behavior of the existing
> Sport code because so many things running in so many dialects rely on
> it in it's current form.

Why is modifying Swazoo ok but modifying Sport nok?

Cheeers
Philippe


Reply | Threaded
Open this post in threaded view
|

Re: SpExceptionContext and error handling

Bruce Badger
2008/6/20 Philippe Marschall <[hidden email]>:
> Last time I checked Hyper wasn't available for Squeak.

I do my work in VW, I have tested Hyper in Squeak a few times to
verify the Sport implementation.  Just use fileout 30 from VW and file
it into Squeak.

> I will not monkey-patch!
I don't know what that means.  I suggest, though, that you fix the
problem where the problem lies.  The onAnyExceptionDo:  does just what
it says on the can, so changing that would be questionable at least.

>> What would not be a good is modifying the behavior of the existing
>> Sport code because so many things running in so many dialects rely on
>> it in it's current form.
>
> Why is modifying Swazoo ok but modifying Sport nok?

Because Sport is an API with distinct implementations in many
dialects.  Thanks to Sport a single fix in Swazoo, which runs on
Sport, will work in many dialects.  Plus the more obvious point about
using intention revealing selectors.

All the best,
    Bruce
--
Make the most of your skills - with OpenSkills
http://www.openskills.org/


Reply | Threaded
Open this post in threaded view
|

Re: SpExceptionContext and error handling

Philippe Marschall
2008/6/20 Bruce Badger <[hidden email]>:
> 2008/6/20 Philippe Marschall <[hidden email]>:
>> Last time I checked Hyper wasn't available for Squeak.
>
> I do my work in VW, I have tested Hyper in Squeak a few times to
> verify the Sport implementation.  Just use fileout 30 from VW and file
> it into Squeak.
>
>> I will not monkey-patch!
> I don't know what that means.

http://gbracha.blogspot.com/2008/03/monkey-patching.html

Cheers
Philippe


Reply | Threaded
Open this post in threaded view
|

Re: SpExceptionContext and error handling

Lautaro Fernández
For the moment I modified the "HTTPConnection>>produceResponseFor:" by changing "for:onAnyExceptionDo:" to "for:on:'Error' do:".

Thank you both for your answers.
Bye,
Lautaro Fernández

--
Luke LAut SkyFernadezWalker
Reply | Threaded
Open this post in threaded view
|

Re: SpExceptionContext and error handling

Bruce Badger
In reply to this post by Philippe Marschall
2008/6/20 Philippe Marschall <[hidden email]>:

>>> I will not monkey-patch!
>> I don't know what that means.
>
> http://gbracha.blogspot.com/2008/03/monkey-patching.html

Ah, right.  Well, good for you, then.  I would tend to avoid it too.

--
Make the most of your skills - with OpenSkills
http://www.openskills.org/