TryCatch

Simon Kirk Simon.Kirk at pinesoft.co.uk
Fri Nov 25 10:12:05 UTC 2005


I may be overstepping my bounds here as an almost complete Squeak newb, 
but given you mentioned "try/catch" then you're probably thinking "in 
Java" so you'll want to know about finally - which as far as I can tell 
is done by:

[code]
     on: Exception
     do: [:ex | more code]
     ensure: [do this no matter what]

(ie the ensure: [] is the same as a finally).

Just my $0.02 - if I'm wrong somebody please correct me :)

stéphane ducasse wrote:

> Damien
>
> read the ExceptionTest classes they are gorgeous. Really This is the  
> best documentation on exception catching
> I ever read... :)
>
> Stef
>
> On 24 nov. 05, at 20:49, Damien Cassou wrote:
>
>> Hi,
>>
>> How can I try/catch for errors in Squeak ? I didn't find anything.  I 
>> would like to do something like :
>>
>> [ aPieceOfCodeThatCanThrowsExceptions ]
>>    catch: [:exception | Transcript show: exception]
>>
>> or
>>
>> self try: [ aPieceOfCodeThatCanThrowsExceptions ]
>>       catch: [:exception | Transcript show: exception]
>>
>>
>> thank you
>>
>>
>> -- 
>> Damien
>>
>
>
>
>
>


This message has been scanned for viruses by BlackSpider MailControl - www.blackspider.com




More information about the Squeak-dev mailing list