Hi Skip,
It is working fine for me
Thank you.
Abdelghani
De : Skip Lentz <[email protected]>
À : abdelghani ALIDRA <[email protected]>; Any question about pharo is
welcome <[email protected]>
Envoyé le : Jeudi 26 novembre 2015 13h38
Objet : Re: [Pharo-users] catching exceptions
Hi, you can use BlockClosure>>on:do:, like this:
[ #() atRandom ] on: Exception do: [ 1 ].
Personally, I would check the collection to be empty before calling.
On Nov 26, 2015, at 1:33 PM, abdelghani ALIDRA <[email protected]> wrote:
Hi everyBody,
I know there is some kind of exceptions handling mechanism in Pharo but I cant
exactly remember where to find it.Actually, I would like to execute specific
code if atRandomis called on an empty Array or Collection.
I probably can still override errorEmptyCollection but maybe there is another
(less radical) way.And by the way, Would it be quicker to use exception
handling then just testing the Collection before calling atRandom.
Thanks
Abdelghani