SignalSet.st
branchjv
changeset 25383 5d948c667c55
parent 21024 8734987eb5c7
--- a/SignalSet.st	Sat Jan 25 21:55:08 2020 +0000
+++ b/SignalSet.st	Wed May 20 18:34:29 2020 +0100
@@ -1,3 +1,5 @@
+"{ Encoding: utf8 }"
+
 "
  COPYRIGHT (c) 1993 by Claus Gittinger
 	      All Rights Reserved
@@ -94,12 +96,15 @@
     "Modified: 27.1.1997 / 20:31:08 / cg"
 ! !
 
+
 !SignalSet methodsFor:'adding'!
 
-, anException
-    "add anException to the set"
+, anExceptionHandler
+    "add anExceptionHandler to the set"
 
-    self add:anException
+    self add:anExceptionHandler.
+
+    "Modified: / 09-12-2019 / 11:09:05 / Stefan Vogel"
 !
 
 add:anExceptionHandler
@@ -107,24 +112,36 @@
      Very bad (recursive) things may happen if e.g. #accepts: is called
      and raises a MessageNotUnderstood error."
 
+    anExceptionHandler isNil ifTrue:[
+        "Ignore nil exceptionHandler - it may be due to a missing (not loaded) expception class"    
+        ^ nil.
+    ].
     anExceptionHandler isExceptionHandler ifFalse:[
 	SignalError raiseWith:anExceptionHandler errorString:' - trying to add a non-exceptionHandler to a SignalSet'.
     ].
     ^ super add:anExceptionHandler.
+
+   "
+        SignalSet with:nil with:TimeoutError
+   "
+
+    "Modified: / 09-12-2019 / 11:08:56 / Stefan Vogel"
 ! !
 
 !SignalSet methodsFor:'queries'!
 
-accepts:anExceptionHandler
+accepts:aSignalOrExceptionClass
     "return true, if the receiver accepts the argument, aSignal.
      (i.e. if any of the receiver's elements is aSignal or a parent of it).
      False otherwise."
 
     self do:[:eachExceptionHandler |
-        (eachExceptionHandler==anExceptionHandler
-         or:[eachExceptionHandler accepts:anExceptionHandler]) ifTrue:[^ true].
+        (eachExceptionHandler==aSignalOrExceptionClass
+         or:[eachExceptionHandler accepts:aSignalOrExceptionClass]) ifTrue:[^ true].
     ].
     ^ false
+
+    "Modified (format): / 28-08-2018 / 11:16:49 / Claus Gittinger"
 !
 
 exceptionHandlerFor:anException in:aContext
@@ -232,7 +249,7 @@
      but remember if the signal was raised.
      After the block evaluation, finally raise the signal - if it was raised in the block.
      If the signal is raised multiple times, only the first raises parameter is remembered,
-     and only a single raise is performed after the blocks evaluation.
+     and only a single raise is performed after the block's evaluation.
 
      Deferring makes sense for some signals, such as UserInterrupt or AbortSignal,
      which must occasionally be delayed temprarily until a save place is reached
@@ -266,6 +283,8 @@
      ].
      Transcript showCR:'3 - here after the protected block.'.
     "
+
+    "Modified (comment): / 13-03-2019 / 10:28:12 / Claus Gittinger"
 !
 
 handle:handleBlock do:aBlock
@@ -324,12 +343,12 @@
 
 ignoreIn:aBlock
     "evaluate the argument, aBlock.
-     Ignore the any signals from the receiver during evaluation - i.e. simply
-     continue. This makes only sense for some signals, such as UserInterrupt
-     or AbortSignals, because continuing after an exception without any cleanup
+     Ignore any signal from the receiver during evaluation - i.e. simply continue with the default resume value. 
+     This makes only sense for some signals, such as UserInterrupt
+     or AbortOperationRequest, because continuing after an exception without any cleanup
      will often lead to followup-errors."
 
-     ^ self handle:[:ex | ex proceedWith:nil] do:aBlock.
+     ^ self handle:[:ex | ex proceed] do:aBlock.
 
      "
       SignalSet anySignal ignoreIn:[
@@ -337,8 +356,9 @@
       ]
      "
 
-     "Created: / 27.1.1997 / 20:32:50 / cg"
-     "Modified: / 4.3.1998 / 16:36:30 / cg"
+    "Created: / 27-01-1997 / 20:32:50 / cg"
+    "Modified (comment): / 24-02-2017 / 11:15:59 / stefan"
+    "Modified (comment): / 20-06-2017 / 13:35:43 / cg"
 ! !
 
 !SignalSet::SetOfAnySignal class methodsFor:'instance creation'!
@@ -378,12 +398,14 @@
 
 !SignalSet::SetOfAnySignal methodsFor:'queries'!
 
-accepts:anExceptionHandler
+accepts:aSignalOrExceptionClass
     "return true, if the receiver accepts the argument, aSignal.
      (i.e. if any of the receiver's elements is aSignal or a parent of it).
      False otherwise. I, the special SetOfAnySignal accepts any (non-query) signal."
 
-    ^ anExceptionHandler isExceptionHandler and:[anExceptionHandler isQuerySignal not]
+    ^ aSignalOrExceptionClass isExceptionHandler and:[aSignalOrExceptionClass isQuerySignal not]
+
+    "Modified (format): / 28-08-2018 / 11:16:55 / Claus Gittinger"
 !
 
 handles:anException