Exception resignaling question

Chris Burkert chris at chrisburkert.de
Tue Jul 29 15:17:06 UTC 2003


Roel Wuyts wrote:
> 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?

I think beacause the block doesn't get the message value or 
something similar.

Try:

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

Regards
            Chris Burkert
-- 
http://www.chrisburkert.de/



More information about the Squeak-dev mailing list