On Thu, Oct 1, 2009 at 3:54 PM, St�phane Ducasse
<stephane.ducasse@inria.fr> wrote:
On Oct 1, 2009, at 8:02 PM, Mariano Martinez Peck wrote:
> Hi folks: First of all I have to say I am pretty sad that error
> handling hasn't a special place in the PBE. In my opinion having a
> good error handling is a MUST in every piece of code. We need to use
> exceptions. I didn't collaborate at all with PBE so I cannot say
> anything to no one :) � I will try to write something for the next
> version if you want. But first...
there is a chapter for the volume two. It is already written and was
rewritten we will release it in the future for making the unpatient
happy.
excellent
�
> We need a better error handling. It is very common to have a
> hierarchy of exceptions or errors. You have subclasses of Error for
> example. And many times, you want to do or not to do or even do
> something different depending on the error you got. Now, the
> question is, how you do this in Squeak ???
have a look at the Exceptions test because they encode the rich
exception mechanism of Smalltalk.
Ok, I will do that then.
�
I could send the exception chapter too :)
please do!!!
�
>
> This is the only (ugly) way I find to do it:
>
> [ a block of code where you do something that can singal different
> exceptions �]
> � � �on: XXXErrror do: [ : ex �| �ex class = XXXError if True: [ 'I
> do what I need to do when I get the error XXX' ].
> � � � � � � � � � � � � � � � � � � � � � ex class = YYYError if
> True: [ 'I do what I need to do when I get the error YYY' ].
> � � � � � � � � � � � � � � � � � � � � � 'here I do in the rest of
> the cases'
> � ]
>
>
> But, I would like to have something like this:
>
>
> [ a block of code where you do something that can singal different
> exceptions �]
> � � on: XXXError
> � � � � do: [ : ex | 'I do what I need to do when I get the error
> XXX' ]
> � � on: YYYError
> � � � � do: [ : ex | 'I do what I need to do when I get the error
> YYY' ]
> � � on: Error
> � � � � do: [ : ex | �'here I do in the rest of the cases' ]
> � � ensure: [ 'Here I do what I always need to do, no matter if
> there is an error or not' ]
>
>
> What do you think about this? does someone ever did something like
> this ? perhaps we can put this as part of 1.1
>
> I listen opinions.
>
> Best,
>
> Mariano