GenericException.st
branchjv
changeset 17797 71451ae83564
parent 17780 b6e42c92eba0
child 17800 142da80d8c82
--- a/GenericException.st	Thu Aug 19 21:39:34 2010 +0100
+++ b/GenericException.st	Thu Aug 26 11:12:57 2010 +0100
@@ -209,9 +209,11 @@
     <context: #return>
 
     ^ (self newException
-        suspendedContext:thisContext sender
-        errorString:messageText)
-            raiseSignal.
+                suspendedContext:thisContext sender
+                errorString:messageText)
+        raiseSignal.
+
+    "Modified: / 10-08-2010 / 09:41:56 / cg"
 ! !
 
 !GenericException class methodsFor:'Compatibility-Squeak'!
@@ -541,13 +543,11 @@
     <context: #return>
     <resource: #skipInDebuggersWalkBack>
 
-    ^ (self newException
-        suspendedContext:thisContext sender)
-        raise
-
-    "Modified: / 2.5.1996 / 16:36:23 / cg"
-    "Modified: / 5.3.1998 / 16:44:36 / stefan"
-    "Created: / 23.7.1999 / 14:07:17 / stefan"
+    ^ self basicNew
+        raiseIn:thisContext sender
+
+    "Created: / 23-07-1999 / 14:07:17 / stefan"
+    "Modified: / 10-08-2010 / 09:30:42 / cg"
 !
 
 raiseErrorString:aString
@@ -557,13 +557,12 @@
     <context: #return>
     <resource: #skipInDebuggersWalkBack>
 
-    ^ (self newException
-        suspendedContext:thisContext sender errorString:aString)
-            raise.
-
-    "Modified: / 9.5.1996 / 15:17:59 / cg"
-    "Modified: / 12.3.1998 / 15:15:22 / stefan"
-    "Created: / 23.7.1999 / 14:07:33 / stefan"
+    ^ self basicNew
+        raiseErrorString:aString
+        in:thisContext sender
+
+    "Created: / 23-07-1999 / 14:07:33 / stefan"
+    "Modified: / 10-08-2010 / 09:34:37 / cg"
 !
 
 raiseErrorString:aString in:aContext
@@ -573,13 +572,11 @@
     <context: #return>
     <resource: #skipInDebuggersWalkBack>
 
-    ^ (self newException
-        suspendedContext:aContext errorString:aString)
-            raise.
-
-    "Modified: / 9.5.1996 / 15:17:59 / cg"
-    "Modified: / 12.3.1998 / 15:15:22 / stefan"
-    "Created: / 23.7.1999 / 14:07:33 / stefan"
+    ^ self basicNew
+        raiseErrorString:aString in:aContext
+
+    "Created: / 23-07-1999 / 14:07:33 / stefan"
+    "Modified: / 10-08-2010 / 09:35:37 / cg"
 !
 
 raiseFrom:something 
@@ -605,13 +602,11 @@
     <context: #return>
     <resource: #skipInDebuggersWalkBack>
 
-    ^ (self newException
-        suspendedContext:thisContext sender)
-        raiseRequest.
-
-    "Modified: / 2.5.1996 / 16:36:52 / cg"
-    "Modified: / 5.3.1998 / 16:50:46 / stefan"
-    "Created: / 23.7.1999 / 14:08:24 / stefan"
+    ^ self basicNew
+        raiseRequestIn:thisContext sender
+
+    "Created: / 23-07-1999 / 14:08:24 / stefan"
+    "Modified: / 10-08-2010 / 09:37:06 / cg"
 !
 
 raiseRequestErrorString:aString
@@ -621,9 +616,10 @@
     <context: #return>
     <resource: #skipInDebuggersWalkBack>
 
-    ^ (self newException
-        suspendedContext:thisContext sender errorString:aString)
-        raiseRequest
+    ^ self basicNew
+        raiseRequestErrorString:aString in:thisContext sender
+
+    "Modified: / 10-08-2010 / 09:40:38 / cg"
 !
 
 raiseRequestFrom:something 
@@ -649,13 +645,11 @@
     <context: #return>
     <resource: #skipInDebuggersWalkBack>
 
-    ^ (self newException
-        suspendedContext:thisContext sender parameter:aParameter)
-        raiseRequest.
-
-    "Modified: / 9.5.1996 / 15:13:20 / cg"
-    "Modified: / 12.3.1998 / 15:16:57 / stefan"
-    "Created: / 23.7.1999 / 14:08:48 / stefan"
+    ^ self basicNew
+        raiseRequestWith:aParameter in:thisContext sender
+
+    "Created: / 23-07-1999 / 14:08:48 / stefan"
+    "Modified: / 10-08-2010 / 09:57:14 / cg"
 !
 
 raiseRequestWith:aParameter errorString:aString
@@ -665,13 +659,11 @@
     <context: #return>
     <resource: #skipInDebuggersWalkBack>
 
-    ^ (self newException
-        suspendedContext:thisContext sender parameter:aParameter errorString:aString)
-        raiseRequest
-
-    "Modified: / 9.5.1996 / 15:13:35 / cg"
-    "Modified: / 12.3.1998 / 15:17:52 / stefan"
-    "Created: / 23.7.1999 / 14:08:57 / stefan"
+    ^ self basicNew
+        raiseRequestWith:aParameter errorString:aString in:thisContext sender
+
+    "Created: / 23-07-1999 / 14:08:57 / stefan"
+    "Modified: / 10-08-2010 / 09:56:55 / cg"
 !
 
 raiseRequestWith:aParameter errorString:aString in:aContext
@@ -683,13 +675,11 @@
     <context: #return>
     <resource: #skipInDebuggersWalkBack>
 
-    ^ (self newException
-        suspendedContext:aContext parameter:aParameter errorString:aString)
-        raiseRequest
-
-    "Modified: / 26.7.1996 / 16:29:27 / cg"
-    "Modified: / 12.3.1998 / 15:18:34 / stefan"
-    "Created: / 23.7.1999 / 14:09:07 / stefan"
+    ^ self basicNew
+        raiseRequestWith:aParameter errorString:aString in:aContext
+
+    "Created: / 23-07-1999 / 14:09:07 / stefan"
+    "Modified: / 10-08-2010 / 09:56:36 / cg"
 !
 
 raiseRequestWith:aParameter in:aContext
@@ -700,9 +690,10 @@
     <context: #return>
     <resource: #skipInDebuggersWalkBack>
 
-    ^ (self newException
-        suspendedContext:aContext parameter:aParameter)
-        raiseRequest
+    ^ self basicNew
+        raiseRequestWith:aParameter in:aContext
+
+    "Modified: / 10-08-2010 / 09:56:12 / cg"
 !
 
 raiseSignal
@@ -791,13 +782,11 @@
     <context: #return>
     <resource: #skipInDebuggersWalkBack>
 
-    ^ (self newException
-        suspendedContext:thisContext sender parameter:aParameter)
-        raise.
-
-    "Modified: / 9.5.1996 / 15:14:24 / cg"
-    "Modified: / 12.3.1998 / 15:19:11 / stefan"
-    "Created: / 23.7.1999 / 14:09:27 / stefan"
+    ^ self basicNew
+        raiseWith:aParameter in:thisContext sender
+
+    "Created: / 23-07-1999 / 14:09:27 / stefan"
+    "Modified: / 10-08-2010 / 09:51:11 / cg"
 !
 
 raiseWith:aParameter errorString:aString
@@ -808,13 +797,11 @@
     <context: #return>
     <resource: #skipInDebuggersWalkBack>
 
-    ^ (self newException
-        suspendedContext:thisContext sender parameter:aParameter errorString:aString)
-        raise.
-
-    "Modified: / 9.5.1996 / 15:14:32 / cg"
-    "Modified: / 12.3.1998 / 15:19:40 / stefan"
-    "Created: / 23.7.1999 / 14:09:36 / stefan"
+    ^ self basicNew
+          raiseWith:aParameter errorString:aString in:thisContext sender.
+
+    "Created: / 23-07-1999 / 14:09:36 / stefan"
+    "Modified: / 10-08-2010 / 09:52:59 / cg"
 !
 
 raiseWith:aParameter errorString:aString in:aContext
@@ -827,13 +814,11 @@
     <context: #return>
     <resource: #skipInDebuggersWalkBack>
 
-    ^ (self newException
-          suspendedContext:aContext parameter:aParameter errorString:aString)
-          raise.
-
-    "Modified: / 26.7.1996 / 16:29:42 / cg"
-    "Modified: / 12.3.1998 / 15:20:12 / stefan"
-    "Created: / 23.7.1999 / 14:09:46 / stefan"
+    ^ self basicNew
+          raiseWith:aParameter errorString:aString in:aContext.
+
+    "Created: / 23-07-1999 / 14:09:46 / stefan"
+    "Modified: / 10-08-2010 / 09:52:10 / cg"
 !
 
 raiseWith:aParameter in:aContext
@@ -845,9 +830,10 @@
     <context: #return>
     <resource: #skipInDebuggersWalkBack>
 
-    ^ (self newException
-          suspendedContext:aContext parameter:aParameter)
-          raise.
+    ^ self basicNew
+        raiseWith:aParameter in:aContext
+
+    "Modified: / 10-08-2010 / 09:52:38 / cg"
 !
 
 signalWith:messageText
@@ -1172,9 +1158,12 @@
 !
 
 creator
-    "return the creator of the exception"
-
-    ^ signal
+    "return the creator of the exception;
+     same as signal, for compatibility"
+
+    ^ signal ? self class
+
+    "Modified: / 10-08-2010 / 09:23:18 / cg"
 !
 
 errorString
@@ -1359,15 +1348,9 @@
 signal
     "return the signal, that caused the exception"
 
-    ^ signal
-!
-
-signal:aSignal
-    "set the signal, that caused the exception"
-
-    signal := aSignal
-
-    "Created: / 5.3.1998 / 16:02:46 / stefan"
+    ^ signal ? self class
+
+    "Modified: / 10-08-2010 / 09:22:33 / cg"
 !
 
 suspendedContext
@@ -1446,9 +1429,11 @@
      Subclasses may redefine this."
 
     proceedable notNil ifTrue:[^ proceedable].
-    ^ signal mayProceed.
-
-    "Created: / 23.7.1999 / 14:48:26 / stefan"
+    signal notNil ifTrue:[^ signal mayProceed].
+    ^ self class mayProceed.
+
+    "Created: / 23-07-1999 / 14:48:26 / stefan"
+    "Modified: / 10-08-2010 / 09:39:15 / cg"
 !
 
 noHandler
@@ -1849,6 +1834,22 @@
 
 !GenericException methodsFor:'private'!
 
+checkProceedable
+    "helper for all raiseRequest methods"
+
+    self mayProceed ifFalse:[
+        StrictRaising ifTrue:[
+            "/ proceeding from wrongProceedabilitySignal grants the raiseRequest
+            WrongProceedabilityError raiseRequestWith:signal
+        ] ifFalse:[
+            self class name infoPrint.
+            ' [warning]: raised with wrong proceedability' infoPrintCR.
+        ]
+    ].
+
+    "Created: / 10-08-2010 / 09:54:41 / cg"
+!
+
 doCallAction
     "call the action proper
      - needed an extra method to have a raise-marked context around
@@ -1904,10 +1905,13 @@
     originator isNil ifTrue:[
         originator := suspendedContext homeReceiver
     ].
-
-    signal isExceptionCreator ifFalse:[
-        "not an exception or Signal - there is something wrong here..."
-        GenericException raiseWith:signal errorString:'unexpected non-ExceptionCreator in calling context'.
+    signal isNil ifTrue:[
+        signal := self class
+    ] ifFalse:[
+        signal isExceptionCreator ifFalse:[
+            "not an exception or Signal - there is something wrong here..."
+            Error "GenericException" raiseWith:signal errorString:'unexpected non-ExceptionCreator in calling context'.
+        ]
     ].
 
     "now, start searching for a handler.
@@ -1977,9 +1981,9 @@
     "
     ^ self doCallAction
 
-    "Created: / 12.5.1996 / 15:09:39 / cg"
-    "Modified: / 9.11.1997 / 14:48:44 / cg"
-    "Modified: / 3.8.1999 / 11:20:41 / stefan"
+    "Created: / 12-05-1996 / 15:09:39 / cg"
+    "Modified: / 03-08-1999 / 11:20:41 / stefan"
+    "Modified: / 10-08-2010 / 09:26:14 / cg"
 ! !
 
 !GenericException methodsFor:'raising'!
@@ -2001,6 +2005,37 @@
     "Modified: / 3.8.1999 / 13:33:01 / stefan"
 !
 
+raiseErrorString:aString in:aContext
+    "raise the signal nonproceedable.
+     The argument, aString is used as messageText"
+
+    <context: #return>
+
+    raiseContext := thisContext.
+    suspendedContext := aContext.
+    messageText := aString.
+    proceedable := false.
+
+    ^ self doRaise
+
+    "Created: / 10-08-2010 / 09:33:43 / cg"
+!
+
+raiseIn:aContext
+    "actually raise a non-proceedable exception"
+
+    <context: #return>
+
+    raiseContext := thisContext.
+    suspendedContext := aContext.
+    proceedable := false.
+
+    ^ self doRaise
+
+    "Modified: / 03-08-1999 / 13:33:01 / stefan"
+    "Created: / 10-08-2010 / 09:30:19 / cg"
+!
+
 raiseRequest
     "actually raise a proceedable exception."
 
@@ -2011,21 +2046,48 @@
         suspendedContext := raiseContext sender
     ].
 
-    self mayProceed ifFalse:[
-        StrictRaising ifTrue:[
-            "/ proceeding from wrongProceedabilitySignal grants the raiseRequest
-            WrongProceedabilityError raiseRequestWith:signal
-        ] ifFalse:[
-            self class name infoPrint.
-            ' [warning]: raised with wrong proceedability' infoPrintCR.
-        ]
-    ].
+    self checkProceedable.
 
     proceedable := true.
     ^ self doRaise
 
     "Modified: / 04-08-1999 / 08:05:12 / stefan"
-    "Modified: / 10-07-2010 / 19:48:42 / cg"
+    "Modified: / 10-08-2010 / 09:55:00 / cg"
+!
+
+raiseRequestErrorString:errorString in:aContext
+    "actually raise a proceedable exception."
+
+    <context: #return>
+
+    raiseContext := thisContext.
+    suspendedContext := aContext.
+    messageText := errorString.
+
+    self checkProceedable.
+
+    proceedable := true.
+    ^ self doRaise
+
+    "Modified: / 04-08-1999 / 08:05:12 / stefan"
+    "Created: / 10-08-2010 / 09:40:05 / cg"
+!
+
+raiseRequestIn:aContext
+    "actually raise a proceedable exception."
+
+    <context: #return>
+
+    raiseContext := thisContext.
+    suspendedContext := aContext.
+
+    self checkProceedable.
+
+    proceedable := true.
+    ^ self doRaise
+
+    "Modified: / 04-08-1999 / 08:05:12 / stefan"
+    "Created: / 10-08-2010 / 09:36:45 / cg"
 !
 
 raiseRequestWith:aParameter errorString:aString
@@ -2041,6 +2103,43 @@
     "Created: / 23.7.1999 / 14:08:57 / stefan"
 !
 
+raiseRequestWith:aParameter errorString:aString in:aContext
+    "actually raise a proceedable exception."
+
+    <context: #return>
+
+    raiseContext := thisContext.
+    suspendedContext := aContext.
+    parameter := aParameter.
+    messageText := aString.
+
+    self checkProceedable.
+
+    proceedable := true.
+    ^ self doRaise
+
+    "Modified: / 04-08-1999 / 08:05:12 / stefan"
+    "Created: / 10-08-2010 / 09:55:48 / cg"
+!
+
+raiseRequestWith:aParameter in:aContext
+    "actually raise a proceedable exception."
+
+    <context: #return>
+
+    raiseContext := thisContext.
+    suspendedContext := aContext.
+    parameter := aParameter.
+
+    self checkProceedable.
+
+    proceedable := true.
+    ^ self doRaise
+
+    "Modified: / 04-08-1999 / 08:05:12 / stefan"
+    "Created: / 10-08-2010 / 09:53:51 / cg"
+!
+
 raiseSignal
     "actually raise an exception (whatever the proceedability is)."
 
@@ -2064,6 +2163,39 @@
     ^ (self 
         suspendedContext:thisContext sender parameter:aParameter errorString:aString)
         raise.
+!
+
+raiseWith:aParameter errorString:aString in:aContext
+    "raise the signal nonproceedable.
+     The argument, aString is used as messageText"
+
+    <context: #return>
+
+    raiseContext := thisContext.
+    suspendedContext := aContext.
+    messageText := aString.
+    parameter := aParameter.
+    proceedable := false.
+
+    ^ self doRaise
+
+    "Created: / 10-08-2010 / 09:51:51 / cg"
+!
+
+raiseWith:aParameter in:aContext
+    "raise the signal nonproceedable.
+     The argument, aString is used as messageText"
+
+    <context: #return>
+
+    raiseContext := thisContext.
+    suspendedContext := aContext.
+    parameter := aParameter.
+    proceedable := false.
+
+    ^ self doRaise
+
+    "Created: / 10-08-2010 / 09:50:54 / cg"
 ! !
 
 !GenericException methodsFor:'setup'!
@@ -2133,18 +2265,19 @@
 !GenericException class methodsFor:'documentation'!
 
 version
-    ^ '$Id: GenericException.st 10544 2010-07-12 16:20:36Z vranyj1 $'
+    ^ '$Id: GenericException.st 10570 2010-08-26 10:12:57Z vranyj1 $'
 !
 
 version_CVS
-    ^ 'Header: /cvs/stx/stx/libbasic/GenericException.st,v 1.125 2010/07/10 17:49:23 cg Exp '
+    ^ 'Header: /cvs/stx/stx/libbasic/GenericException.st,v 1.126 2010/08/10 08:34:53 cg Exp '
 !
 
 version_SVN
-    ^ '$Id: GenericException.st 10544 2010-07-12 16:20:36Z vranyj1 $'
+    ^ '$Id: GenericException.st 10570 2010-08-26 10:12:57Z vranyj1 $'
 ! !
 
 GenericException initialize!
 
 
 
+