Exception resignaling question

Roel Wuyts wuyts at iam.unibe.ch
Tue Jul 29 14:55:54 UTC 2003


Hello,
I have a question regarding exception handling that I'd like some help 
with. Consider the following piece of code:

	| caught |
	caught _ OrderedCollection new.
	[self error: 'Simplest piece of code throwing an error']
		on: Error
		do: [:exc | caught add: exc].
	caught
		do: [:exception | exception resignalAs: exception class new]

Why doesn't it raise an error when I evaluate it in a workspace?

The idea is simply that somehow I get a collection of exceptions (the 
caught instance variable contains one Error instance in the example). 
Then I loop over these exceptions and try to resignal them. But this 
does not work (however, it works in my change notification system, but 
not in the unit tests for this - that is why I came up with this 
simplified example). Can anybody tell me what I need to do to make this 
work (e.g. to raise an error when I evaluate it)? I wanted to do this 
quite naively, but it is probably a bit too simple :-)

--
Roel Wuyts                                                   Software 
Composition Group
roel.wuyts at iam.unibe.ch                       University of Bern, 
Switzerland
http://www.iam.unibe.ch/~wuyts/
Board Member of the European Smalltalk User Group: www.esug.org



More information about the Squeak-dev mailing list