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...

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

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
_______________________________________________
Pharo-project mailing list
[email protected]
http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project

Reply via email to