Waldemar Schwan | 3 Sep 02:23

Exceptions in Squeak


> 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

Gmane