Signal.st
changeset 1362 36e887173783
parent 1326 60ea3687ee49
child 1608 440faca45e37
--- a/Signal.st	Thu May 09 12:54:12 1996 +0200
+++ b/Signal.st	Thu May 09 15:24:26 1996 +0200
@@ -122,6 +122,7 @@
         Exception 
         SignalSet QuerySignal
         Object
+        (``Exception handling and signals'': programming/exceptions.html)
 "
 ! !
 
@@ -271,19 +272,34 @@
 
 !Signal methodsFor:'private'!
 
-errorStringFor:template
-    "used when raising with a given error string; if the given
-     errorString starts with a space, it is appended to the receivers
+errorStringFor:errorString with:aParameter
+    "used when raising with a given error string and/or parameter; 
+     if the errorString starts with a space, it is appended to the receivers
      notifier string; if it ends with a space, it is prepended.
-     Otherwise, the errorString is returned."
+     Otherwise, the errorString is returned.
+     If no errorString is given, use the signals default notifierString."
+
+    |t pS|
 
-    (template startsWith:' ') ifTrue:[
-	^ notifierString , template
+    errorString isNil ifTrue:[
+        t := notifierString
+    ] ifFalse:[
+        t := errorString
+    ].
+
+    aParameter isNil ifTrue:[
+        ^ t
     ].
-    (template endsWith:' ') ifTrue:[
-	^ template , notifierString
+
+    (t startsWith:' ') ifTrue:[
+        ^ aParameter printString , t
     ].
-    ^ template
+    (t endsWith:' ') ifTrue:[
+        ^ t , aParameter printString
+    ].
+    ^ t
+
+    "Modified: 9.5.1996 / 15:18:58 / cg"
 ! !
 
 !Signal methodsFor:'queries'!
@@ -388,10 +404,10 @@
     ^ (Exception  
               signal:self
               parameter:nil 
-              errorString:(self errorStringFor:aString)
+              errorString:(self errorStringFor:aString with:nil)
               suspendedContext:thisContext sender) raise.
 
-    "Modified: 2.5.1996 / 16:36:31 / cg"
+    "Modified: 9.5.1996 / 15:17:59 / cg"
 !
 
 raiseFrom:something
@@ -448,10 +464,10 @@
     ^ (Exception 
               signal:self
               parameter:aParameter 
-              errorString:notifierString
+              errorString:(self errorStringFor:nil with:aParameter)
               suspendedContext:thisContext sender) raiseRequest.
 
-    "Modified: 2.5.1996 / 16:36:58 / cg"
+    "Modified: 9.5.1996 / 15:13:20 / cg"
 !
 
 raiseRequestWith:aParameter errorString:aString
@@ -461,10 +477,10 @@
     ^ (Exception 
               signal:self
               parameter:aParameter 
-              errorString:(self errorStringFor:aString)
+              errorString:(self errorStringFor:aString with:aParameter)
               suspendedContext:thisContext sender) raiseRequest
 
-    "Modified: 2.5.1996 / 16:37:03 / cg"
+    "Modified: 9.5.1996 / 15:13:35 / cg"
 !
 
 raiseRequestWith:aParameter errorString:aString in:aContext
@@ -475,10 +491,10 @@
     ^ (Exception 
               signal:self
               parameter:aParameter 
-              errorString:(self errorStringFor:aString)
+              errorString:(self errorStringFor:aString with:aParameter)
               suspendedContext:aContext) raiseRequest
 
-    "Modified: 2.5.1996 / 16:37:09 / cg"
+    "Modified: 9.5.1996 / 15:13:59 / cg"
 !
 
 raiseRequestWith:aParameter in:aContext
@@ -489,10 +505,10 @@
     ^ (Exception 
               signal:self
               parameter:aParameter 
-              errorString:notifierString
+              errorString:(self errorStringFor:nil with:aParameter)
               suspendedContext:aContext) raiseRequest.
 
-    "Modified: 2.5.1996 / 16:37:13 / cg"
+    "Modified: 9.5.1996 / 15:14:16 / cg"
 !
 
 raiseWith:aParameter
@@ -505,10 +521,10 @@
     ^ (Exception 
               signal:self
               parameter:aParameter 
-              errorString:notifierString
+              errorString:(self errorStringFor:nil with:aParameter)
               suspendedContext:thisContext sender) raise.
 
-    "Modified: 2.5.1996 / 16:36:14 / cg"
+    "Modified: 9.5.1996 / 15:14:24 / cg"
 !
 
 raiseWith:aParameter errorString:aString
@@ -521,10 +537,10 @@
     ^ (Exception 
               signal:self
               parameter:aParameter 
-              errorString:(self errorStringFor:aString)
+              errorString:(self errorStringFor:aString with:aParameter)
               suspendedContext:thisContext sender) raise.
 
-    "Modified: 2.5.1996 / 16:36:05 / cg"
+    "Modified: 9.5.1996 / 15:14:32 / cg"
 !
 
 raiseWith:aParameter errorString:aString in:aContext
@@ -537,11 +553,11 @@
     ^ (Exception 
               signal:self
               parameter:aParameter 
-              errorString:(self errorStringFor:aString)
+              errorString:(self errorStringFor:aString with:aParameter)
               suspendedContext:aContext) raise.
 
-    "Modified: 2.5.1996 / 16:36:05 / cg"
     "Created: 2.5.1996 / 16:37:25 / cg"
+    "Modified: 9.5.1996 / 15:14:40 / cg"
 ! !
 
 !Signal methodsFor:'save evaluation'!
@@ -653,6 +669,6 @@
 !Signal class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /cvs/stx/stx/libbasic/Signal.st,v 1.35 1996-05-02 15:21:19 cg Exp $'
+    ^ '$Header: /cvs/stx/stx/libbasic/Signal.st,v 1.36 1996-05-09 13:24:26 cg Exp $'
 ! !
 Signal initialize!