Exception.st
changeset 142 c7844287bddf
parent 130 e09411db2573
child 171 129f0e2e23df
--- a/Exception.st	Wed Aug 24 01:08:34 1994 +0200
+++ b/Exception.st	Wed Aug 24 01:09:46 1994 +0200
@@ -24,7 +24,7 @@
 COPYRIGHT (c) 1993 by Claus Gittinger
               All Rights Reserved
 
-$Header: /cvs/stx/stx/libbasic/Exception.st,v 1.11 1994-08-22 12:19:19 claus Exp $
+$Header: /cvs/stx/stx/libbasic/Exception.st,v 1.12 1994-08-23 23:09:12 claus Exp $
 '!
 
 !Exception class methodsFor:'documentation'!
@@ -45,7 +45,7 @@
 
 version
 "
-$Header: /cvs/stx/stx/libbasic/Exception.st,v 1.11 1994-08-22 12:19:19 claus Exp $
+$Header: /cvs/stx/stx/libbasic/Exception.st,v 1.12 1994-08-23 23:09:12 claus Exp $
 "
 !
 
@@ -53,54 +53,53 @@
 "
     Instances of Exception are passed to a Signal handling block as argument.
     The handler block may perform various actions by sending corresponding messages
-    to the exception handler. The following actions are possible:
+    to the exception object. The following actions are possible:
 
         reject          - dont handle this signal;
                           another handler will be searched for, 
                           upper in the calling hierarchy
+                          (this is also the handlers default, if it falls through)
 
-        proceed         - continue after the Signal>>raise, returning nil as value
+        proceed         - return from the Signal>>raise, with nil as value
+
         proceedWith:val - same, but return val from Signal>>raise
 
-        return          - return from the Signal>>handle:do:, returning nil as value
+        return          - return from the Signal>>handle:do:, with nil as value
+
         return:val      - same, but return val from Signal>>handle:do:
 
         restart         - restart the Signal>>handle:do:, after repairing
 
-    Via the Exception object, the handler can also query the state of execution,
+    Via the Exception object, the handler can also query the state of execution:
     where the Signal was raised, where the handler is, the signal which caused
-    the error and the errorString passed when the signal was raised:
+    the error and the errorString passed when the signal was raised. Also, an optional
+    parameter can be passed - the use is signal specific.:
 
     instance variables:
-        signal          - the signal which caused the exception
-        parameter       - a parameter (if any) which was passed when raising
-                          the signal (only if raised with #raiseWith:aParameter)
+        signal           <Signal>     the signal which caused the exception
+
+        parameter        <Object>     a parameter (if any) which was passed when raising
+                                      the signal (only if raised with #raiseWith:aParameter)
+
+        errorString      <String>     an errorString 
+                                      (usually the signals own errorString, but sometimes
+                                       changed explicitely in #raiseWith:errorString:)
 
-        errorString     - an errorString (only if raised wiith #raiseWith:errorString:)
-        suspendedContext- the context where the signal raise occured
-        handlerContext  - the context of the handler itself
+        suspendedContext <Context>    the context in which the raise occured
+
+        handlerContext   <Context>    the context of the handler (if any)
+
+        resumeBlock      <Block>      private to the exception; needed to perform resume action
 
-        resumeBlock     - private to the exception; needed to perform resume action
-        rejectBlock     - private to the exception; needed to perfomr reject action
+        rejectBlock      <Block>      private to the exception; needed to perform reject action
 
-    In case of an unhandled signal raise, Exceptions EmergenyHandler (a two-argument
-    block) will be evaluated, getting the exception and context as arguments.
+    In case of an unhandled signal raise, Exceptions EmergenyHandler will be evaluated. 
     The default emergeny handler will enter the debugger.
+
     For applications, which do not want Debuggers to come up, other handlers are
     possible.
     For example: to get the typical C++ behavior, use:
-        Exception emergencyHandler:[:ex :con | Smalltalk exitWithCoreDump]
-
-
-    instance variables:
-        signal           <Signal>   the signal which is responsible for all of this
-        parameter        <Object>   the parameter passed to raiseRequestWith: or nil (for raise)
-        errorString      <String>   the signals notifierString, or the string given to raise
-        suspendedContext <Context>  the context, in which the raise occured
-
-        handlerContext   <Context>  the handlers (if found) context
-        resumeBlock      <Block>    used during handler evaluation to get back
-        rejectBlock      <Block>    used during handler evaluation to reject
+        Exception emergencyHandler:[:ex | Smalltalk exitWithCoreDump]
 
     Class variables:
         EmergencyHandler <Block>    this block is evaluated, if no handler was defined
@@ -123,7 +122,13 @@
     "
     EmergencyHandler isNil ifTrue:[
         EmergencyHandler := [:ex |
-            (ex signal) enterDebuggerWith:(ex errorString).
+            "
+             sending it to the signal allows per-signal specific
+             debuggers to be implemented in the future
+             (for example, segv in primitive code could show things 
+              on the C-level ..)
+            "
+            (ex signal) enterDebuggerWith:ex message:(ex errorString).
         ]
     ].