[BUG?] Exception handle

Boris Gaertner Boris.Gaertner at gmx.net
Thu Mar 4 01:14:36 UTC 2004

 "ICHIKAWA, Yuji" <y.ich at f3.dion.ne.jp> wrote: 

> Hi,
> [1/0] ifCurtailed: [Transcript show: 'exception']
> doesn't work on Squeak 3.6-#5429, I guess.
Well, I find ifCurtailed: difficult to understand myself,
and I feel that "doesn't work" does not tell what you
When you evaluate the statement above, you get
an error notifier. When you choose 'abandon' that
notifier closes and the string 'exception' is written
into the Transcript. I tried this also with  VisualWorks,
Dolphin and Smalltalk/X and it is the same everywhere.

Perhaps you were not pleased to see the error notifier.
Then you should use

 [1/0] ifError: [Transcript show: 'exception']. 

You may also try this:

[[1/0] ifCurtailed: [Transcript show: 'exception']
   ] on: ZeroDivide
     do: [:exception | exception return: nil].

Here you have a handler that caches the exception.
You will therefore not see a notifier, but the message
is written into the transcript because you jump out of
the block. I think this is the intended use.
ifCurtailed: is a kind of clean up during a jump. The
example above can be easily modified to close files
or communication lines.

> Is there anything wrong?
I think not, but I would really be happy to see an
understandable explanation of  ifCurtailed.

Hope this helps, Boris 

More information about the Squeak-dev mailing list