Exception.st
changeset 621 87602c9d071c
parent 547 7772f34ce597
child 662 df7953db3847
--- a/Exception.st	Thu Nov 23 11:46:35 1995 +0100
+++ b/Exception.st	Thu Nov 23 11:48:27 1995 +0100
@@ -11,10 +11,8 @@
 "
 
 Object subclass:#Exception
-	 instanceVariableNames:'signal parameter errorString
-				suspendedContext handlerContext
-				rejected originator
-				resumeBlock rejectBlock'
+	 instanceVariableNames:'signal parameter errorString suspendedContext handlerContext
+                rejected originator resumeBlock rejectBlock'
 	 classVariableNames:'EmergencyHandler RecursiveExceptionSignal'
 	 poolDictionaries:''
 	 category:'Kernel-Exceptions'
@@ -36,10 +34,6 @@
 "
 !
 
-version
-    ^ '$Header: /cvs/stx/stx/libbasic/Exception.st,v 1.27 1995-11-14 21:58:45 cg Exp $'
-!
-
 documentation
 "
     Instances of Exception are passed to a Signal handling block as argument.
@@ -108,6 +102,10 @@
 			 <Signal>   raised when within a handler for some signal,
 				    th same signal is raised again.
 "
+!
+
+version
+    ^ '$Header: /cvs/stx/stx/libbasic/Exception.st,v 1.28 1995-11-23 10:48:27 cg Exp $'
 ! !
 
 !Exception class methodsFor:'initialization'!
@@ -122,6 +120,32 @@
     ]
 ! !
 
+!Exception class methodsFor:'instance creation'!
+
+signal:aSignal parameter:aParameter errorString:aString suspendedContext:sContext
+    "create a new instance and set the fields in preparation for a raise.
+     - only to be sent from the signal when raising"
+
+    ^ (self new)
+	signal:aSignal 
+	parameter:aParameter 
+	errorString:aString 
+	suspendedContext:sContext 
+	originator:(sContext receiver).
+!
+
+signal:aSignal parameter:aParameter errorString:aString suspendedContext:sContext originator:origin
+    "create a new instance and set the fields in preparation for a raise.
+     - only to be sent from the signal when raising"
+
+    ^ (self new)
+	signal:aSignal 
+	parameter:aParameter 
+	errorString:aString 
+	suspendedContext:sContext 
+	originator:origin.
+! !
+
 !Exception class methodsFor:'Signal constants'!
 
 recursiveExceptionSignal
@@ -183,47 +207,8 @@
     "
 ! !
 
-!Exception class methodsFor:'instance creation'!
-
-signal:aSignal parameter:aParameter errorString:aString suspendedContext:sContext originator:origin
-    "create a new instance and set the fields in preparation for a raise.
-     - only to be sent from the signal when raising"
-
-    ^ (self new)
-	signal:aSignal 
-	parameter:aParameter 
-	errorString:aString 
-	suspendedContext:sContext 
-	originator:origin.
-! 
-
-signal:aSignal parameter:aParameter errorString:aString suspendedContext:sContext
-    "create a new instance and set the fields in preparation for a raise.
-     - only to be sent from the signal when raising"
-
-    ^ (self new)
-	signal:aSignal 
-	parameter:aParameter 
-	errorString:aString 
-	suspendedContext:sContext 
-	originator:(sContext receiver).
-! !
-
 !Exception methodsFor:'accessing'!
 
-signal
-    "return the signal, that caused the exception"
-
-    ^ signal
-!
-
-parameter
-    "return the parameter passsed with the signal raise
-     (or nil, if there was none)"
-
-    ^ parameter
-!
-
 errorString 
     "return the errorString passsed with the signal raise
      (or nil, if there was none)"
@@ -231,6 +216,12 @@
     ^ errorString
 !
 
+handlerContext
+    "return the context of the handler"
+
+    ^ handlerContext
+!
+
 originator 
     "return the originator passsed with the signal raise
      (or nil, if there was none)"
@@ -238,16 +229,11 @@
     ^ originator
 !
 
-handlerContext
-    "return the context of the handler"
+parameter
+    "return the parameter passsed with the signal raise
+     (or nil, if there was none)"
 
-    ^ handlerContext
-!
-
-suspendedContext
-    "return the context in which the raise occured"
-
-    ^ suspendedContext
+    ^ parameter
 !
 
 rejected
@@ -261,40 +247,98 @@
     ^ rejected
 !
 
+signal
+    "return the signal, that caused the exception"
+
+    ^ signal
+!
+
+suspendedContext
+    "return the context in which the raise occured"
+
+    ^ suspendedContext
+!
+
 willProceed
     "return true, if the exception is proceedable"
 
     ^ resumeBlock notNil
 ! !
 
-!Exception methodsFor:'setup'!
+!Exception methodsFor:'handler actions'!
+
+proceed
+    "Continue after the raise - the raise returns nil"
+
+    resumeBlock notNil ifTrue:[resumeBlock value:nil]
+!
+
+proceedWith:value
+    "Continue after the raise - the raise returns value"
+
+    resumeBlock notNil ifTrue:[resumeBlock value:value]
+!
 
-signal:aSignal parameter:aParameter errorString:aString suspendedContext:sContext originator:origin
-    "set the fields usable for inspection by the handler
-     - only to be sent from the signal when raising"
+reject
+    "handler decided not to handle this signal -
+     system will look for another handler"
+
+    rejected := true.
+    rejectBlock value
+!
+
+restart
+    "restart the handle:do: - usually after some repair work is done
+     in handler"
+
+    handlerContext unwindAndRestart
+!
 
-    signal := aSignal.
-    parameter := aParameter.
-    errorString := aString.
-    suspendedContext := sContext.
-    originator := origin.
+resume
+    "Continue after the raise - the raise returns nil"
+
+    resumeBlock notNil ifTrue:[resumeBlock value:nil]
+!
+
+resumeWith:value
+    "Continue after the raise - the raise returns value"
+
+    resumeBlock notNil ifTrue:[resumeBlock value:value]
+!
+
+return
+    "Continue after the handle:do: - the handle:do: returns nil"
+
+    handlerContext unwind
+!
+
+returnDoing:aBlock
+    "Continue after the handle:do: - the handle:do: returns aBlock value"
+
+    handlerContext unwindThenDo:aBlock
+!
+
+returnWith:value
+    "Continue after the handle:do: - the handle:do: returns value"
+
+    handlerContext unwind:value
 ! !
 
 !Exception methodsFor:'raising'!
 
-raise
-    "actually raise a nonproceedable exception.
-     For now, same as #raiseRequest (always proceedable)."
+doCallHandler:aHandler
+    "call the handler proper - needed an extra method
+     to have a separate returnContext for the rejectBlock.
+     (which is historical, and actually no longer needed)"
+
+    |val|
 
-    resumeBlock := [:value | ^ value].
-    ^ self evaluateHandler
-!
-
-raiseRequest
-    "actually raise a proceedable exception."
-
-    resumeBlock := [:value | ^ value].
-    ^ self evaluateHandler
+    rejectBlock := [^ self]. "this will return on reject"
+    val := aHandler value:self.
+    "
+     handler fall through - is just like a returnWith:blocks-value
+    "
+    self returnWith:val
 !
 
 evaluateHandler
@@ -425,76 +469,32 @@
     ^ block value:self.
 !
 
-doCallHandler:aHandler
-    "call the handler proper - needed an extra method
-     to have a separate returnContext for the rejectBlock.
-     (which is historical, and actually no longer needed)"
-
-    |val|
-
-    rejectBlock := [^ self]. "this will return on reject"
-    val := aHandler value:self.
-    "
-     handler fall through - is just like a returnWith:blocks-value
-    "
-    self returnWith:val
-! !
-
-!Exception methodsFor:'handler actions'!
+raise
+    "actually raise a nonproceedable exception.
+     For now, same as #raiseRequest (always proceedable)."
 
-reject
-    "handler decided not to handle this signal -
-     system will look for another handler"
-
-    rejected := true.
-    rejectBlock value
-!
-
-resume
-    "Continue after the raise - the raise returns nil"
-
-    resumeBlock notNil ifTrue:[resumeBlock value:nil]
-!
-
-resumeWith:value
-    "Continue after the raise - the raise returns value"
-
-    resumeBlock notNil ifTrue:[resumeBlock value:value]
+    resumeBlock := [:value | ^ value].
+    ^ self evaluateHandler
 !
 
-proceed
-    "Continue after the raise - the raise returns nil"
-
-    resumeBlock notNil ifTrue:[resumeBlock value:nil]
-!
-
-proceedWith:value
-    "Continue after the raise - the raise returns value"
+raiseRequest
+    "actually raise a proceedable exception."
 
-    resumeBlock notNil ifTrue:[resumeBlock value:value]
-!
+    resumeBlock := [:value | ^ value].
+    ^ self evaluateHandler
+! !
 
-return
-    "Continue after the handle:do: - the handle:do: returns nil"
-
-    handlerContext unwind
-!
+!Exception methodsFor:'setup'!
 
-returnWith:value
-    "Continue after the handle:do: - the handle:do: returns value"
-
-    handlerContext unwind:value
-!
-
-returnDoing:aBlock
-    "Continue after the handle:do: - the handle:do: returns aBlock value"
+signal:aSignal parameter:aParameter errorString:aString suspendedContext:sContext originator:origin
+    "set the fields usable for inspection by the handler
+     - only to be sent from the signal when raising"
 
-    handlerContext unwindThenDo:aBlock
-!
+    signal := aSignal.
+    parameter := aParameter.
+    errorString := aString.
+    suspendedContext := sContext.
+    originator := origin.
+! !
 
-restart
-    "restart the handle:do: - usually after some repair work is done
-     in handler"
-
-    handlerContext unwindAndRestart
-! !
+Exception initialize!