On Nov 24, 2009, at 11:09 44AM, Bart Gauquie wrote:
I enjoyed the chapter :-). It was very informative, and illustrated yet again how flexible Smalltalk can be. Is there any particular reason why this 'essential' chapter was not included in the first edition of Pharo by Example? It wasn't done yet, probably :)
I also have a question about the contents. In chapter '1.14 Catching sets of exceptions' it is explained how catch a set of exceptions but not how to define a different handler on each exception. For instance i want to handle a more specific FileDoesNotExistException in a different way than a more general FileStreamException, or even Exception. The way i can do this, i see, is to test which type of exception is coming into the do: block and execute appropriate code. This is a very bad solution. Or secondly, to create nested on: do: blocks with the most specific exception as inner block. This seems better, but is kind of verbose. Is there another way to solve this problem? This was discussed abit some time ago, might want to read:
http://n2.nabble.com/better-error-handling-td3750946.html#a3750946 Cheers, Henry