error signal

Damien Cassou damien.cassou at gmail.com
Mon May 7 14:59:08 UTC 2007


2007/5/7, Norbert Hartl <norbert at hartl.name>:
> On Mon, 2007-05-07 at 16:26 +0200, Damien Cassou wrote:
> > Hi Norbert,
> >
> > 2007/5/7, Norbert Hartl <norbert at hartl.name>:
> > >         error signal = true
> > >                 ifTrue:
> > >                         [self reset.
> > >                         self logout.
> > >                         self reLogin.
> > >                         exception restart]
> > >
> > > This code comes from VW. Is the signal method implemented
> > > differently under VW. In squeak the "error signal" itself
> > > throws the error so there is no ifTrue: evaluation, right?

I think I understand (I've just read the squeak unit tests :-)).

When 'error signal' is sent, the exception is raised. The method
execution stops. Somewhere in the stack, the method should be captured
like:

[self doSomethingThatMightRaiseAGlorpDatabaseReadError]
  on: GlorpDatabaseReadError
  do: [:exc | self manageTheException.
                   exc resume: true]

or

resume: false

Then the control is sent back to where the exception has been raised.
What was passed to #resume: is returned by #signal.

-- 
Damien Cassou



More information about the Squeak-dev mailing list