--- a/ProceedingNotification.st Tue May 15 18:26:47 2018 +0200
+++ b/ProceedingNotification.st Tue May 15 20:23:41 2018 +0200
@@ -1,3 +1,5 @@
+"{ Encoding: utf8 }"
+
"
COPYRIGHT (c) 2013 by eXept Software AG
All Rights Reserved
@@ -53,127 +55,51 @@
examples
"
- an up-notification from a deeply nested operation to a higher level.
- Notice, that in contrast to a regular Notification, all outer handlers are called:
- [exBegin]
- |zero|
-
- zero := 0.
- CascadingNotification handle:[:n |
- Transcript showCR:'h1: ' , n description.
- n proceedWith:1.
- ] do:[
- CascadingNotification handle:[:n |
- Transcript showCR:'h2: ' , n description.
- ] do:[
- CascadingNotification handle:[:n |
- Transcript showCR:'h3: ' , n description.
- ] do:[
- 'nesting'.
- [
- [
- Error handle:[:ex |
- Transcript showCR:'some error: ' , ex errorString.
- ex proceed
- ] do:[
- [
- |answer|
-
- 1 // zero. 'an error which is caught in the handler'.
- answer := CascadingNotification notify:'hello world'.
- Transcript show:'after notification 1: '; showCR:answer.
- ] value
- ]
- ] value
- ] value.
- Transcript showCR:'after notification 2'.
- ].
- Transcript showCR:'after notification 3'.
- ].
- Transcript showCR:'after notification 4'.
- ].
- Transcript showCR:'after notification 5'.
- [exEnd]
-
- however, if any handler proceeds or returns, this is not the case:
+ Notice, that in contrast to a regular Notification, the execution proceeds after the Notification:
[exBegin]
|zero|
zero := 0.
- CascadingNotification handle:[:n |
- Transcript showCR:'h1: ' , n description.
+ ProceedingNotification handle:[:n |
+ Transcript showCR:'h: ' , n description.
] do:[
- CascadingNotification handle:[:n |
- Transcript showCR:'h2: ' , n description.
- n proceedWith:2.
+ Error handle:[:ex |
+ Transcript showCR:'some error: ' , ex errorString.
+ ex proceed
] do:[
- CascadingNotification handle:[:n |
- Transcript showCR:'h3: ' , n description.
- ] do:[
- 'nesting'.
- [
- [
- Error handle:[:ex |
- Transcript showCR:'some error: ' , ex errorString.
- ex proceed
- ] do:[
- [
- |answer|
+ [
+ |answer|
- 1 // zero. 'an error which is caught in the handler'.
- answer := CascadingNotification notify:'hello world'.
- Transcript show:'after notification 1: '; showCR:answer.
- ] value
- ]
- ] value
- ] value.
- Transcript showCR:'after notification 2'.
- ].
- Transcript showCR:'after notification 3'.
- ].
- Transcript showCR:'after notification 4'.
+ 1 // zero. 'an error which is caught in the handler'.
+ answer := ProceedingNotification notify:'hello world'.
+ Transcript show:'after notification: '; showCR:answer.
+ ] value
+ ]
].
- Transcript showCR:'after notification 5'.
[exEnd]
- however, if any handler proceeds or returns, this is not the case:
+
+ however, if the handler returns, this is not the case:
[exBegin]
|zero|
zero := 0.
- CascadingNotification handle:[:n |
- Transcript showCR:'h1: ' , n description.
+ ProceedingNotification handle:[:n |
+ Transcript showCR:'h: ' , n description.
+ n return.
] do:[
- CascadingNotification handle:[:n |
- Transcript showCR:'h2: ' , n description.
- n return.
+ Error handle:[:ex |
+ Transcript showCR:'some error: ' , ex errorString.
+ ex proceed
] do:[
- CascadingNotification handle:[:n |
- Transcript showCR:'h3: ' , n description.
- ] do:[
- 'nesting'.
- [
- [
- Error handle:[:ex |
- Transcript showCR:'some error: ' , ex errorString.
- ex proceed
- ] do:[
- [
- |answer|
+ [
+ |answer|
- 1 // zero. 'an error which is caught in the handler'.
- answer := CascadingNotification notify:'hello world'.
- Transcript show:'after notification 1: '; showCR:answer.
- ] value
- ]
- ] value
- ] value.
- Transcript showCR:'after notification 2'.
- ].
- Transcript showCR:'after notification 3'.
- ].
- Transcript showCR:'after notification 4'.
+ 1 // zero. 'an error which is caught in the handler'.
+ answer := ProceedingNotification notify:'hello world'.
+ Transcript show:'after notification 1: '; showCR:answer.
+ ] value
+ ]
].
- Transcript showCR:'after notification 5'.
[exEnd]
"
! !