3 Sep 02:23
Exceptions in Squeak
From: Waldemar Schwan <waldemar.schwan <at> googlemail.com>
Subject: Exceptions in Squeak
Newsgroups: gmane.comp.lang.smalltalk.squeak.beginners
Date: 2008-09-03 00:26:01 GMT
Subject: Exceptions in Squeak
Newsgroups: gmane.comp.lang.smalltalk.squeak.beginners
Date: 2008-09-03 00:26:01 GMT
> What I wanted was an exception (try/except) in case any of the reads > failed. Corrupt files are an expected case that should be handled by > the program. So I can't crash while reading (or writing). Does Squeak > have exceptions? Or is there a Smalltalk pattern for this "try to > execute this, do something else if it fails"? That answer should > probably go into another thread. > > David You may take a look at BlockContext, exception protocoll. BlockContext is the class of [ ] . If you are searching for a try catch, try [ self doingThingsThatMayThrowErrors ] on: Error do: [ something ]. example: [ Error new signal] on: Error do: [Transcript show: 'error']. Regards Waldemar
RSS Feed