The Trunk: Help-Squeak-TerseGuide-pre.6.mcz

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

The Trunk: Help-Squeak-TerseGuide-pre.6.mcz

commits-2
Patrick Rein uploaded a new version of Help-Squeak-TerseGuide to project The Trunk:
http://source.squeak.org/trunk/Help-Squeak-TerseGuide-pre.6.mcz

==================== Summary ====================

Name: Help-Squeak-TerseGuide-pre.6
Author: pre
Time: 25 May 2016, 10:31:44.454733 am
UUID: d0c651c0-c1cb-46c8-982a-ea2ec9f08c60
Ancestors: Help-Squeak-TerseGuide-kfr.5

Added a section on exception handling

=============== Diff against Help-Squeak-TerseGuide-kfr.5 ===============

Item was added:
+ ----- Method: TerseGuideHelp class>>exceptionHandling (in category 'pages') -----
+ exceptionHandling
+
+ ^HelpTopic
+ title: 'Exception Handling'
+ contents:
+
+ '"************************************************************************
+  * Exceptions: *
+  ************************************************************************"
+ | x |
+ x := Object new.
+ x error: ''Throwing an error''.
+
+ NotFound signal. "simply throwing a specific exception"
+ NotFound signal: ''Throwing with a message''. "throwing an exception with a custom text"
+
+ x := [ 5 / 0 ] "simple exception handler"
+ on: ZeroDivide do: [ 10 ].
+ x := [ 5 / 0 ] "processing the exception in an exception handler"
+ on: Error do: [:e | Transcript showln: e printString ].
+ x := [ 5 / 0 ] "different exception handlers for the same block"
+ on: ZeroDivide do: [ 10 ]
+ on: MessageNotUnderstood do: [ 20 ].
+ x := [ 5 / 0 ] "one exception handler for two different exceptions"
+ on: ZeroDivide , ArithmeticError do: [ 10 ].
+
+
+ '!

Item was changed:
  ----- Method: TerseGuideHelp class>>pages (in category 'accessing') -----
  pages
 
  ^ #( introduction transcript assignment constants boolean arithmetic
+ bitwise conversion block exceptionHandling methodCall conditionalStatement
- bitwise conversion block methodCall conditionalStatement
  iterationStatement character symbol string array orderedCollection
  sortedCollection bag set interval association dictionary internalStream
  fileStream date time point rectangle pen dynamic metaclass debugging
  misc )!