Exceptions (Was RE: [ANN] Cleaned up KomHttpServer on SM)
Ned Konz
ned at squeakland.org
Fri Nov 5 16:14:12 UTC 2004
On Thursday 04 November 2004 8:11 pm, Russell Penney wrote:
> Thanks for the comments. If you do have to handle an Exceptions down in
> the bowels of your code, is it better to perhaps handle the Exception and
> then signal a more general Exception so that code further up can still
> detect something has gone wrong?
The proper approach is to make specific Exception subclasses that have the
desired default behavior, so if they aren't caught, something reasonable
happens anyway.
Alternatively (that is, if you have to deal with Errors or Exception types
that don't have the right default behavior), an idiom that I've used from
time to time is:
[ some code ]
on: Error
do: [ :ex | ex isNestedifTrue: [ "another handler on the stack"
--
Ned Konz
http://bike-nomad.com/squeak/
More information about the Squeak-dev
mailing list
|