author | Jan Vrany <jan.vrany@fit.cvut.cz> |
Mon, 10 Jun 2013 17:32:35 +0100 | |
branch | jv |
changeset 18066 | 89d51443ba6f |
parent 18060 | 3708e12e9aa8 |
parent 15375 | 6beaee1cdc53 |
child 18120 | e3a375d5f6a8 |
permissions | -rw-r--r-- |
1 | 1 |
" |
2 |
COPYRIGHT (c) 1993 by Claus Gittinger |
|
4502 | 3 |
All Rights Reserved |
1 | 4 |
|
5 |
This software is furnished under a license and may be used |
|
6 |
only in accordance with the terms of that license and with the |
|
7 |
inclusion of the above copyright notice. This software may not |
|
8 |
be provided or otherwise made available to, or used by, any |
|
9 |
other person. No title to or ownership of the software is |
|
10 |
hereby transferred. |
|
11 |
" |
|
5515 | 12 |
"{ Package: 'stx:libbasic' }" |
13 |
||
1 | 14 |
Object subclass:#Signal |
4564 | 15 |
instanceVariableNames:'mayProceed notifierString nameClass message handlerBlock parent' |
16 |
classVariableNames:'' |
|
17 |
poolDictionaries:'' |
|
18 |
category:'Kernel-Exceptions' |
|
1 | 19 |
! |
20 |
||
2207 | 21 |
!Signal class methodsFor:'documentation'! |
44 | 22 |
|
88 | 23 |
copyright |
24 |
" |
|
25 |
COPYRIGHT (c) 1993 by Claus Gittinger |
|
4502 | 26 |
All Rights Reserved |
88 | 27 |
|
28 |
This software is furnished under a license and may be used |
|
29 |
only in accordance with the terms of that license and with the |
|
30 |
inclusion of the above copyright notice. This software may not |
|
31 |
be provided or otherwise made available to, or used by, any |
|
32 |
other person. No title to or ownership of the software is |
|
33 |
hereby transferred. |
|
34 |
" |
|
35 |
! |
|
36 |
||
44 | 37 |
documentation |
38 |
" |
|
6429
d0a5a78e6227
better impl. of #deferAfter:
Claus Gittinger <cg@exept.de>
parents:
6396
diff
changeset
|
39 |
Note: |
8384 | 40 |
The instance based Signal framework is being replaced by class based exceptions. |
6429
d0a5a78e6227
better impl. of #deferAfter:
Claus Gittinger <cg@exept.de>
parents:
6396
diff
changeset
|
41 |
I.e. what used to be instances of Signal/QuerySignal is beeing |
d0a5a78e6227
better impl. of #deferAfter:
Claus Gittinger <cg@exept.de>
parents:
6396
diff
changeset
|
42 |
rewritten into subclasses of Exception/Error/Query and Warning. |
8384 | 43 |
|
6429
d0a5a78e6227
better impl. of #deferAfter:
Claus Gittinger <cg@exept.de>
parents:
6396
diff
changeset
|
44 |
Although the functionality is basically unchanged, the new |
d0a5a78e6227
better impl. of #deferAfter:
Claus Gittinger <cg@exept.de>
parents:
6396
diff
changeset
|
45 |
class based exceptions are easier to instanciate (no need for |
d0a5a78e6227
better impl. of #deferAfter:
Claus Gittinger <cg@exept.de>
parents:
6396
diff
changeset
|
46 |
creation in a classes initialize method), easier to use (no real |
8384 | 47 |
need for Signal-constant accessors) and allow for easier parameter |
6429
d0a5a78e6227
better impl. of #deferAfter:
Claus Gittinger <cg@exept.de>
parents:
6396
diff
changeset
|
48 |
passing (not only a single parameter, but allows for individual |
d0a5a78e6227
better impl. of #deferAfter:
Claus Gittinger <cg@exept.de>
parents:
6396
diff
changeset
|
49 |
exception subclasses to add additional state). |
d0a5a78e6227
better impl. of #deferAfter:
Claus Gittinger <cg@exept.de>
parents:
6396
diff
changeset
|
50 |
|
8384 | 51 |
However, the old Signal hierarchy will remain in existance, since it allows |
52 |
funny instance-specific and anonymous exception handling schemes to be |
|
53 |
implemented, which are hard to built using class-based exceptions. |
|
6429
d0a5a78e6227
better impl. of #deferAfter:
Claus Gittinger <cg@exept.de>
parents:
6396
diff
changeset
|
54 |
|
70 | 55 |
Signal and Exception provide a framework for exception handling. |
44 | 56 |
|
70 | 57 |
A Signal object is usually defined somewhere up in the calling chain |
58 |
and associated with some abnormal event. Many signals are also |
|
59 |
created at startup time and reused. |
|
44 | 60 |
|
70 | 61 |
When the event is raised (by Signal>>raise) the control will be either |
62 |
given to a debugger or - if a handler was defined - to the handler. |
|
63 |
The handler will get a description of what (and where) happened in an |
|
120 | 64 |
Exception object and can decide how to react on the situation (i.e. |
65 |
proceed, return or restart). |
|
70 | 66 |
|
67 |
There is also a companion class called SignalSet, which allows handling |
|
68 |
multiple signals with one handler (for example all arithmetic signals). |
|
69 |
And, finally there is a very special SignalSet which allows catching |
|
70 |
any signal (SignalSet>>anySignal). |
|
71 |
||
171 | 72 |
Since there is no official documentation on signal handling (i.e. none |
73 |
of the books describes it), this Signal implementation has been modeled |
|
74 |
after what some PD programs seem to expect and what alpha/beta testers told |
|
75 |
me it should look like. |
|
76 |
It may not be perfect and undergo minor changes. |
|
44 | 77 |
|
120 | 78 |
special: |
79 |
||
70 | 80 |
In addition to the nested catch & throw mechanism, signals can also be |
120 | 81 |
used when no such handler scope exists. To support this, signals can be |
82 |
assigned a handlerBlock, which gets evaluated with the exception as argument |
|
83 |
in case no handler was found (on the stack). |
|
70 | 84 |
|
171 | 85 |
If no handler was found (i.e. neither a handler context on the stack, nor |
86 |
a static handler block), the NoHandlerSignal will be raised instead, |
|
120 | 87 |
passing it the original exception in its exception-parameter. |
171 | 88 |
This NoHandlerSignal can be handled just like any other signal. |
89 |
(therefore, it is possible to catch any error by catching NoHandlerSignal. |
|
70 | 90 |
|
120 | 91 |
When the NoHandler signal is raised, and neither a handler-context, nor |
92 |
a handler block is defined for it, an emergencyHandler(-block) is evaluated. |
|
93 |
This block is either provided by the current process |
|
94 |
(see Process>>emergencySignalHandler) or as a global default by the Exception |
|
95 |
class (see Exception>>emergencyHandler). |
|
96 |
The default emergencyHandlerBlock (from Exception) will bring up a debugger. |
|
97 |
||
98 |
HandlerBlocks allow a global (if its the EmergencyHandler in Exception) |
|
99 |
or per-process signal handling to be added. Even to code which was never |
|
100 |
planned to handle signals. |
|
70 | 101 |
|
171 | 102 |
See samples in 'doc/coding' and actual raise code in Exception. |
1 | 103 |
|
1275 | 104 |
[Instance variables:] |
70 | 105 |
|
4502 | 106 |
mayProceed <Boolean> hint for the debugger - program may |
107 |
proceed (currently not honored by the |
|
108 |
debugger) |
|
1275 | 109 |
|
4502 | 110 |
notifierString <String> error message to be output |
70 | 111 |
|
4502 | 112 |
nameClass <Class> for the printOn-implementation; nameClass |
113 |
is the class, to which message (below) |
|
114 |
should be sent to create the receiver. |
|
1 | 115 |
|
4502 | 116 |
message <Symbol> for the printOn-implementation; message |
117 |
is the selector, which should be sent to |
|
118 |
nameClass (above) to create the receiver. |
|
1 | 119 |
|
4502 | 120 |
handlerBlock <Block> if nonNil, a 1-arg block to be |
121 |
evaluated when no handler context is |
|
122 |
found. The block gets the exception |
|
123 |
object as argument. This will play the role |
|
124 |
of an on-stack handler. |
|
1275 | 125 |
|
1292 | 126 |
[author:] |
4502 | 127 |
Claus Gittinger |
1292 | 128 |
|
1275 | 129 |
[see also:] |
4554 | 130 |
GenericException |
4502 | 131 |
SignalSet QuerySignal |
132 |
Object |
|
133 |
(``Exception handling and signals'': programming/exceptions.html) |
|
44 | 134 |
" |
135 |
! ! |
|
1 | 136 |
|
2207 | 137 |
!Signal class methodsFor:'instance creation'! |
1 | 138 |
|
139 |
new |
|
140 |
"return a new signal" |
|
141 |
||
4438 | 142 |
^ (self basicNew) notifierString:'signal'; mayProceed:true |
3004
220af5090ec2
added the genericSignal for PP compatiblity
Claus Gittinger <cg@exept.de>
parents:
2893
diff
changeset
|
143 |
|
220af5090ec2
added the genericSignal for PP compatiblity
Claus Gittinger <cg@exept.de>
parents:
2893
diff
changeset
|
144 |
" |
220af5090ec2
added the genericSignal for PP compatiblity
Claus Gittinger <cg@exept.de>
parents:
2893
diff
changeset
|
145 |
Signal new |
220af5090ec2
added the genericSignal for PP compatiblity
Claus Gittinger <cg@exept.de>
parents:
2893
diff
changeset
|
146 |
" |
220af5090ec2
added the genericSignal for PP compatiblity
Claus Gittinger <cg@exept.de>
parents:
2893
diff
changeset
|
147 |
|
220af5090ec2
added the genericSignal for PP compatiblity
Claus Gittinger <cg@exept.de>
parents:
2893
diff
changeset
|
148 |
"Modified: 8.10.1997 / 11:51:39 / cg" |
1 | 149 |
! ! |
150 |
||
2207 | 151 |
!Signal class methodsFor:'Signal constants'! |
1 | 152 |
|
3004
220af5090ec2
added the genericSignal for PP compatiblity
Claus Gittinger <cg@exept.de>
parents:
2893
diff
changeset
|
153 |
genericSignal |
220af5090ec2
added the genericSignal for PP compatiblity
Claus Gittinger <cg@exept.de>
parents:
2893
diff
changeset
|
154 |
"return the generic signal - thats the parent of all signals |
220af5090ec2
added the genericSignal for PP compatiblity
Claus Gittinger <cg@exept.de>
parents:
2893
diff
changeset
|
155 |
in the system." |
220af5090ec2
added the genericSignal for PP compatiblity
Claus Gittinger <cg@exept.de>
parents:
2893
diff
changeset
|
156 |
|
4518
4716c8d7cb4c
Implement NoHandlerException etc. as class based exceptions.
Stefan Vogel <sv@exept.de>
parents:
4513
diff
changeset
|
157 |
^ GenericException |
3004
220af5090ec2
added the genericSignal for PP compatiblity
Claus Gittinger <cg@exept.de>
parents:
2893
diff
changeset
|
158 |
|
4518
4716c8d7cb4c
Implement NoHandlerException etc. as class based exceptions.
Stefan Vogel <sv@exept.de>
parents:
4513
diff
changeset
|
159 |
"Created: / 8.10.1997 / 11:46:28 / cg" |
4716c8d7cb4c
Implement NoHandlerException etc. as class based exceptions.
Stefan Vogel <sv@exept.de>
parents:
4513
diff
changeset
|
160 |
"Modified: / 8.10.1997 / 11:47:08 / cg" |
4716c8d7cb4c
Implement NoHandlerException etc. as class based exceptions.
Stefan Vogel <sv@exept.de>
parents:
4513
diff
changeset
|
161 |
"Modified: / 4.8.1999 / 08:54:33 / stefan" |
3004
220af5090ec2
added the genericSignal for PP compatiblity
Claus Gittinger <cg@exept.de>
parents:
2893
diff
changeset
|
162 |
! |
220af5090ec2
added the genericSignal for PP compatiblity
Claus Gittinger <cg@exept.de>
parents:
2893
diff
changeset
|
163 |
|
1 | 164 |
noHandlerSignal |
44 | 165 |
"return the signal used to handle unhandled signals" |
166 |
||
4527 | 167 |
^ NoHandlerError |
4518
4716c8d7cb4c
Implement NoHandlerException etc. as class based exceptions.
Stefan Vogel <sv@exept.de>
parents:
4513
diff
changeset
|
168 |
|
4716c8d7cb4c
Implement NoHandlerException etc. as class based exceptions.
Stefan Vogel <sv@exept.de>
parents:
4513
diff
changeset
|
169 |
"Modified: / 4.8.1999 / 08:10:09 / stefan" |
1 | 170 |
! ! |
171 |
||
15113
20b7764bc56a
use #creator instead of #signal
Claus Gittinger <cg@exept.de>
parents:
14961
diff
changeset
|
172 |
!Signal methodsFor:'Compatibility-ANSI'! |
20b7764bc56a
use #creator instead of #signal
Claus Gittinger <cg@exept.de>
parents:
14961
diff
changeset
|
173 |
|
20b7764bc56a
use #creator instead of #signal
Claus Gittinger <cg@exept.de>
parents:
14961
diff
changeset
|
174 |
signalWith:messageText |
20b7764bc56a
use #creator instead of #signal
Claus Gittinger <cg@exept.de>
parents:
14961
diff
changeset
|
175 |
"ANSI compatibility" |
20b7764bc56a
use #creator instead of #signal
Claus Gittinger <cg@exept.de>
parents:
14961
diff
changeset
|
176 |
|
20b7764bc56a
use #creator instead of #signal
Claus Gittinger <cg@exept.de>
parents:
14961
diff
changeset
|
177 |
self raiseErrorString:messageText |
20b7764bc56a
use #creator instead of #signal
Claus Gittinger <cg@exept.de>
parents:
14961
diff
changeset
|
178 |
! ! |
20b7764bc56a
use #creator instead of #signal
Claus Gittinger <cg@exept.de>
parents:
14961
diff
changeset
|
179 |
|
7261 | 180 |
!Signal methodsFor:'Compatibility-VW'! |
5300
a66fa98a839a
compatibility stuff: #new, #messageText: and #raiseSignal
Claus Gittinger <cg@exept.de>
parents:
4759
diff
changeset
|
181 |
|
a66fa98a839a
compatibility stuff: #new, #messageText: and #raiseSignal
Claus Gittinger <cg@exept.de>
parents:
4759
diff
changeset
|
182 |
messageText:aString |
a66fa98a839a
compatibility stuff: #new, #messageText: and #raiseSignal
Claus Gittinger <cg@exept.de>
parents:
4759
diff
changeset
|
183 |
^ self notifierString:aString |
a66fa98a839a
compatibility stuff: #new, #messageText: and #raiseSignal
Claus Gittinger <cg@exept.de>
parents:
4759
diff
changeset
|
184 |
! |
a66fa98a839a
compatibility stuff: #new, #messageText: and #raiseSignal
Claus Gittinger <cg@exept.de>
parents:
4759
diff
changeset
|
185 |
|
a66fa98a839a
compatibility stuff: #new, #messageText: and #raiseSignal
Claus Gittinger <cg@exept.de>
parents:
4759
diff
changeset
|
186 |
new |
a66fa98a839a
compatibility stuff: #new, #messageText: and #raiseSignal
Claus Gittinger <cg@exept.de>
parents:
4759
diff
changeset
|
187 |
"create a new signal, using the receiver as a prototype and |
a66fa98a839a
compatibility stuff: #new, #messageText: and #raiseSignal
Claus Gittinger <cg@exept.de>
parents:
4759
diff
changeset
|
188 |
setting the parent of the new signal to the receiver." |
a66fa98a839a
compatibility stuff: #new, #messageText: and #raiseSignal
Claus Gittinger <cg@exept.de>
parents:
4759
diff
changeset
|
189 |
|
a66fa98a839a
compatibility stuff: #new, #messageText: and #raiseSignal
Claus Gittinger <cg@exept.de>
parents:
4759
diff
changeset
|
190 |
^ self newSignal |
a66fa98a839a
compatibility stuff: #new, #messageText: and #raiseSignal
Claus Gittinger <cg@exept.de>
parents:
4759
diff
changeset
|
191 |
! ! |
a66fa98a839a
compatibility stuff: #new, #messageText: and #raiseSignal
Claus Gittinger <cg@exept.de>
parents:
4759
diff
changeset
|
192 |
|
622 | 193 |
!Signal methodsFor:'accessing'! |
1 | 194 |
|
15375 | 195 |
creator |
196 |
"return the creator of the exception (for exception protocol compatibilty)" |
|
197 |
||
198 |
^ self |
|
199 |
! |
|
200 |
||
622 | 201 |
errorString |
7206 | 202 |
"errorString is deprecated, use description instead" |
203 |
||
204 |
<resource:#obsolete> |
|
1 | 205 |
|
4563 | 206 |
^ self description |
622 | 207 |
! |
159 | 208 |
|
622 | 209 |
handlerBlock |
210 |
"return the handlerblock - if non-nil, this will be evaluated with the exception |
|
211 |
object as argument, if no #handle:do: context was found on the stack." |
|
212 |
||
213 |
^ handlerBlock |
|
1 | 214 |
! |
215 |
||
622 | 216 |
handlerBlock:aOneArgBlock |
217 |
"set the handlerblock - this will be evaluated with the exception |
|
218 |
object as argument, if no #handle:do: context was found on the stack." |
|
159 | 219 |
|
622 | 220 |
handlerBlock := aOneArgBlock |
221 |
! |
|
159 | 222 |
|
622 | 223 |
mayProceed |
224 |
"return the signals ability to proceed. |
|
225 |
This flag is (currently) not checked by the system; |
|
226 |
be prepared for changes here, to eventually have nonProceedable |
|
227 |
signals refuse to let you continue execution." |
|
1 | 228 |
|
622 | 229 |
^ mayProceed |
1 | 230 |
! |
231 |
||
232 |
mayProceed:aBoolean |
|
44 | 233 |
"set/clear the signals ability to proceed. |
419 | 234 |
This flag is (currently) not checked by the system; |
235 |
be prepared for changes here, to eventually have nonProceedable |
|
236 |
signals refuse to let you continue execution." |
|
1 | 237 |
|
238 |
mayProceed := aBoolean |
|
239 |
! |
|
240 |
||
622 | 241 |
nameClass:aClass message:aSelector |
242 |
"this sets the class & selector of a method which returns |
|
243 |
that signal - this is simply for documentation purposes - |
|
244 |
see Signal>>printOn: implementation. |
|
245 |
(took me a while to find that one out ;-)" |
|
419 | 246 |
|
622 | 247 |
nameClass := aClass. |
248 |
message := aSelector |
|
419 | 249 |
! |
250 |
||
622 | 251 |
notifierString |
252 |
"return the notifier string" |
|
159 | 253 |
|
622 | 254 |
^ notifierString |
255 |
! |
|
256 |
||
257 |
notifierString:aString |
|
258 |
"set the notifier string" |
|
259 |
||
260 |
notifierString := aString |
|
159 | 261 |
! |
262 |
||
14961 | 263 |
originalSignal |
264 |
"return the signal/exception which was originally raised. |
|
265 |
For noHandler, that is my unhandled signal; for others, thats the exception itself." |
|
266 |
||
267 |
^ self. |
|
268 |
! |
|
269 |
||
159 | 270 |
parent |
271 |
"return the parent-signal of the receiver" |
|
272 |
||
273 |
^ parent |
|
274 |
! |
|
275 |
||
622 | 276 |
parent:aSignal |
277 |
"set the parent-signal of the receiver." |
|
278 |
||
279 |
parent := aSignal |
|
3004
220af5090ec2
added the genericSignal for PP compatiblity
Claus Gittinger <cg@exept.de>
parents:
2893
diff
changeset
|
280 |
! |
220af5090ec2
added the genericSignal for PP compatiblity
Claus Gittinger <cg@exept.de>
parents:
2893
diff
changeset
|
281 |
|
220af5090ec2
added the genericSignal for PP compatiblity
Claus Gittinger <cg@exept.de>
parents:
2893
diff
changeset
|
282 |
parent:aSignal mayProceed:aBoolean |
220af5090ec2
added the genericSignal for PP compatiblity
Claus Gittinger <cg@exept.de>
parents:
2893
diff
changeset
|
283 |
"set the parent-signal and the mayProceed flag of the receiver." |
220af5090ec2
added the genericSignal for PP compatiblity
Claus Gittinger <cg@exept.de>
parents:
2893
diff
changeset
|
284 |
|
3010 | 285 |
parent := aSignal. |
286 |
mayProceed := aBoolean. |
|
3004
220af5090ec2
added the genericSignal for PP compatiblity
Claus Gittinger <cg@exept.de>
parents:
2893
diff
changeset
|
287 |
|
220af5090ec2
added the genericSignal for PP compatiblity
Claus Gittinger <cg@exept.de>
parents:
2893
diff
changeset
|
288 |
"Modified: 8.10.1997 / 11:56:11 / cg" |
622 | 289 |
! ! |
290 |
||
5835 | 291 |
!Signal methodsFor:'converting'! |
292 |
||
8239 | 293 |
, anExceptionHandler |
294 |
"return a SignalSet with myself and anExceptionHandler" |
|
5835 | 295 |
|
8239 | 296 |
^ SignalSet with:self with:anExceptionHandler |
5835 | 297 |
! ! |
298 |
||
622 | 299 |
!Signal methodsFor:'copying'! |
300 |
||
10953 | 301 |
deepCopyUsing:aDictionary postCopySelector:postCopySelector |
622 | 302 |
"raise an error - deepCopy is not allowed for signals" |
1 | 303 |
|
622 | 304 |
^ self deepCopyError |
3348
37b0481be091
must catch #deppCopyUsing: instead of #deepCopy.
Claus Gittinger <cg@exept.de>
parents:
3280
diff
changeset
|
305 |
|
37b0481be091
must catch #deppCopyUsing: instead of #deepCopy.
Claus Gittinger <cg@exept.de>
parents:
3280
diff
changeset
|
306 |
"Created: / 31.3.1998 / 15:43:01 / cg" |
622 | 307 |
! ! |
308 |
||
8681
38aa963476a5
Support for Block>>#on:do:on:do:
Stefan Vogel <sv@exept.de>
parents:
8384
diff
changeset
|
309 |
!Signal methodsFor:'exception creation'! |
38aa963476a5
Support for Block>>#on:do:on:do:
Stefan Vogel <sv@exept.de>
parents:
8384
diff
changeset
|
310 |
|
38aa963476a5
Support for Block>>#on:do:on:do:
Stefan Vogel <sv@exept.de>
parents:
8384
diff
changeset
|
311 |
newException |
8685
06c1d82512f5
QuerySignal generates Notifications instead of Exceptions.
Stefan Vogel <sv@exept.de>
parents:
8681
diff
changeset
|
312 |
"{ Pragma: +inlineNew }" |
8681
38aa963476a5
Support for Block>>#on:do:on:do:
Stefan Vogel <sv@exept.de>
parents:
8384
diff
changeset
|
313 |
"answer a new exception object for this signal. |
38aa963476a5
Support for Block>>#on:do:on:do:
Stefan Vogel <sv@exept.de>
parents:
8384
diff
changeset
|
314 |
Subclasses may redefine this method" |
38aa963476a5
Support for Block>>#on:do:on:do:
Stefan Vogel <sv@exept.de>
parents:
8384
diff
changeset
|
315 |
|
15239 | 316 |
^ Exception basicNew creator:self |
8681
38aa963476a5
Support for Block>>#on:do:on:do:
Stefan Vogel <sv@exept.de>
parents:
8384
diff
changeset
|
317 |
|
38aa963476a5
Support for Block>>#on:do:on:do:
Stefan Vogel <sv@exept.de>
parents:
8384
diff
changeset
|
318 |
"Created: / 26.2.1998 / 19:53:56 / stefan" |
38aa963476a5
Support for Block>>#on:do:on:do:
Stefan Vogel <sv@exept.de>
parents:
8384
diff
changeset
|
319 |
"Modified: / 23.7.1999 / 13:41:00 / stefan" |
38aa963476a5
Support for Block>>#on:do:on:do:
Stefan Vogel <sv@exept.de>
parents:
8384
diff
changeset
|
320 |
! ! |
38aa963476a5
Support for Block>>#on:do:on:do:
Stefan Vogel <sv@exept.de>
parents:
8384
diff
changeset
|
321 |
|
622 | 322 |
!Signal methodsFor:'instance creation'! |
1 | 323 |
|
622 | 324 |
newSignal |
325 |
"create a new signal, using the receiver as a prototype and |
|
326 |
setting the parent of the new signal to the receiver." |
|
1 | 327 |
|
3010 | 328 |
^ (self copy) parent:self |
3004
220af5090ec2
added the genericSignal for PP compatiblity
Claus Gittinger <cg@exept.de>
parents:
2893
diff
changeset
|
329 |
|
220af5090ec2
added the genericSignal for PP compatiblity
Claus Gittinger <cg@exept.de>
parents:
2893
diff
changeset
|
330 |
"Modified: 8.10.1997 / 11:53:06 / cg" |
70 | 331 |
! |
332 |
||
622 | 333 |
newSignalMayProceed:aBoolean |
334 |
"create a new signal, using the receiver as a prototype and |
|
335 |
setting the parent of the new signal to the receiver." |
|
362 | 336 |
|
3010 | 337 |
^ (self copy) parent:self mayProceed:aBoolean |
70 | 338 |
|
3004
220af5090ec2
added the genericSignal for PP compatiblity
Claus Gittinger <cg@exept.de>
parents:
2893
diff
changeset
|
339 |
"Modified: 8.10.1997 / 11:57:13 / cg" |
1 | 340 |
! ! |
341 |
||
5570 | 342 |
!Signal methodsFor:'printing & storing'! |
159 | 343 |
|
4563 | 344 |
description |
345 |
"return the notifier string. |
|
346 |
If the notifier string starts with space, prepend |
|
347 |
the parents notifier string" |
|
348 |
||
6116 | 349 |
|s| |
350 |
||
4563 | 351 |
notifierString isNil ifTrue:[ |
8292 | 352 |
^ parent description |
5949 | 353 |
]. |
6116 | 354 |
s := notifierString asString. |
355 |
(s startsWith:Character space) ifTrue:[ |
|
356 |
^ parent description, s |
|
5949 | 357 |
]. |
6116 | 358 |
^ s |
4563 | 359 |
|
360 |
" |
|
8292 | 361 |
Error description |
4563 | 362 |
" |
363 |
||
364 |
"Modified: / 12.3.1998 / 15:04:41 / stefan" |
|
365 |
! |
|
366 |
||
14961 | 367 |
descriptionForDebugger |
368 |
"return the description string of the signal which is used in the |
|
369 |
debugger title area" |
|
370 |
||
371 |
^ self description. |
|
372 |
! |
|
373 |
||
159 | 374 |
printOn:aStream |
375 |
"append a printed representation of the receiver on aStream" |
|
376 |
||
377 |
nameClass notNil ifTrue:[ |
|
4622
905b21c17057
care for non-class nameClass in printOn:
Claus Gittinger <cg@exept.de>
parents:
4564
diff
changeset
|
378 |
nameClass isBehavior ifTrue:[ |
905b21c17057
care for non-class nameClass in printOn:
Claus Gittinger <cg@exept.de>
parents:
4564
diff
changeset
|
379 |
aStream nextPutAll:nameClass name. |
905b21c17057
care for non-class nameClass in printOn:
Claus Gittinger <cg@exept.de>
parents:
4564
diff
changeset
|
380 |
] ifFalse:[ |
905b21c17057
care for non-class nameClass in printOn:
Claus Gittinger <cg@exept.de>
parents:
4564
diff
changeset
|
381 |
nameClass printOn:aStream. |
905b21c17057
care for non-class nameClass in printOn:
Claus Gittinger <cg@exept.de>
parents:
4564
diff
changeset
|
382 |
]. |
4502 | 383 |
aStream space. |
384 |
aStream nextPutAll:message. |
|
385 |
^ self |
|
159 | 386 |
]. |
387 |
^ super printOn:aStream |
|
388 |
! ! |
|
389 |
||
622 | 390 |
!Signal methodsFor:'queries'! |
391 |
||
392 |
accepts:aSignal |
|
393 |
"return true, if the receiver accepts the argument, aSignal. |
|
394 |
(i.e. the receiver is aSignal or a parent of it). False otherwise." |
|
395 |
||
396 |
|s| |
|
397 |
||
4527 | 398 |
self == aSignal ifTrue:[^ true]. |
622 | 399 |
aSignal isQuerySignal ifTrue:[^ false]. |
400 |
||
8681
38aa963476a5
Support for Block>>#on:do:on:do:
Stefan Vogel <sv@exept.de>
parents:
8384
diff
changeset
|
401 |
s := aSignal parent. |
622 | 402 |
[s notNil] whileTrue:[ |
4438 | 403 |
self == s ifTrue:[^ true]. |
404 |
s := s parent |
|
622 | 405 |
]. |
406 |
^ false |
|
4438 | 407 |
|
408 |
"Modified: / 22.3.1999 / 12:45:42 / stefan" |
|
622 | 409 |
! |
410 |
||
10776 | 411 |
catchInDebugger |
412 |
"if set, the debugger will handle this signal in its event loop and will close itself |
|
413 |
without asking for close-confirmation. |
|
414 |
This allows for debugged processes to be terminated without a user confirmation dialog |
|
415 |
(for now, this is used in expecco's hard-terminate function to shut down any open debuggers |
|
416 |
together with the test-process)" |
|
417 |
||
418 |
^ false |
|
419 |
! |
|
420 |
||
8681
38aa963476a5
Support for Block>>#on:do:on:do:
Stefan Vogel <sv@exept.de>
parents:
8384
diff
changeset
|
421 |
exceptionHandlerFor:anException in:aContext |
38aa963476a5
Support for Block>>#on:do:on:do:
Stefan Vogel <sv@exept.de>
parents:
8384
diff
changeset
|
422 |
"answer the exceptionHandler for anException from aContext." |
38aa963476a5
Support for Block>>#on:do:on:do:
Stefan Vogel <sv@exept.de>
parents:
8384
diff
changeset
|
423 |
|
38aa963476a5
Support for Block>>#on:do:on:do:
Stefan Vogel <sv@exept.de>
parents:
8384
diff
changeset
|
424 |
^ self |
38aa963476a5
Support for Block>>#on:do:on:do:
Stefan Vogel <sv@exept.de>
parents:
8384
diff
changeset
|
425 |
! |
38aa963476a5
Support for Block>>#on:do:on:do:
Stefan Vogel <sv@exept.de>
parents:
8384
diff
changeset
|
426 |
|
4464
cec93c942c14
Use context flag for exception handling instead of searching for
Stefan Vogel <sv@exept.de>
parents:
4440
diff
changeset
|
427 |
handlerForSignal:signal context:theContext originator:originator |
cec93c942c14
Use context flag for exception handling instead of searching for
Stefan Vogel <sv@exept.de>
parents:
4440
diff
changeset
|
428 |
"answer the handler block for the signal from originator. |
cec93c942c14
Use context flag for exception handling instead of searching for
Stefan Vogel <sv@exept.de>
parents:
4440
diff
changeset
|
429 |
The block is retrieved from aContext. |
cec93c942c14
Use context flag for exception handling instead of searching for
Stefan Vogel <sv@exept.de>
parents:
4440
diff
changeset
|
430 |
Answer nil if the signal is not handled" |
cec93c942c14
Use context flag for exception handling instead of searching for
Stefan Vogel <sv@exept.de>
parents:
4440
diff
changeset
|
431 |
|
cec93c942c14
Use context flag for exception handling instead of searching for
Stefan Vogel <sv@exept.de>
parents:
4440
diff
changeset
|
432 |
|
cec93c942c14
Use context flag for exception handling instead of searching for
Stefan Vogel <sv@exept.de>
parents:
4440
diff
changeset
|
433 |
(theContext selector ~~ #'handle:from:do:' |
cec93c942c14
Use context flag for exception handling instead of searching for
Stefan Vogel <sv@exept.de>
parents:
4440
diff
changeset
|
434 |
or:[(theContext argAt:2) == originator]) ifTrue:[ |
4513 | 435 |
(self == signal or:[self accepts:signal]) ifTrue:[ |
11637
a29ee3f72ce2
changed #handlerForSignal:context:originator:
Stefan Vogel <sv@exept.de>
parents:
10953
diff
changeset
|
436 |
^ (theContext argAt:1) ? [nil] |
4464
cec93c942c14
Use context flag for exception handling instead of searching for
Stefan Vogel <sv@exept.de>
parents:
4440
diff
changeset
|
437 |
] |
cec93c942c14
Use context flag for exception handling instead of searching for
Stefan Vogel <sv@exept.de>
parents:
4440
diff
changeset
|
438 |
]. |
cec93c942c14
Use context flag for exception handling instead of searching for
Stefan Vogel <sv@exept.de>
parents:
4440
diff
changeset
|
439 |
|
cec93c942c14
Use context flag for exception handling instead of searching for
Stefan Vogel <sv@exept.de>
parents:
4440
diff
changeset
|
440 |
^ nil |
cec93c942c14
Use context flag for exception handling instead of searching for
Stefan Vogel <sv@exept.de>
parents:
4440
diff
changeset
|
441 |
|
cec93c942c14
Use context flag for exception handling instead of searching for
Stefan Vogel <sv@exept.de>
parents:
4440
diff
changeset
|
442 |
"Created: / 25.7.1999 / 19:55:43 / stefan" |
cec93c942c14
Use context flag for exception handling instead of searching for
Stefan Vogel <sv@exept.de>
parents:
4440
diff
changeset
|
443 |
! |
cec93c942c14
Use context flag for exception handling instead of searching for
Stefan Vogel <sv@exept.de>
parents:
4440
diff
changeset
|
444 |
|
4547
082a2f7d9d8e
Add #handlerProtectedBlock:inContext
Stefan Vogel <sv@exept.de>
parents:
4540
diff
changeset
|
445 |
handlerProtectedBlock:doBlock inContext:context |
082a2f7d9d8e
Add #handlerProtectedBlock:inContext
Stefan Vogel <sv@exept.de>
parents:
4540
diff
changeset
|
446 |
"set the handlerProtectedBlock in context" |
082a2f7d9d8e
Add #handlerProtectedBlock:inContext
Stefan Vogel <sv@exept.de>
parents:
4540
diff
changeset
|
447 |
|
082a2f7d9d8e
Add #handlerProtectedBlock:inContext
Stefan Vogel <sv@exept.de>
parents:
4540
diff
changeset
|
448 |
context selector == #handle:do: ifTrue:[ |
082a2f7d9d8e
Add #handlerProtectedBlock:inContext
Stefan Vogel <sv@exept.de>
parents:
4540
diff
changeset
|
449 |
context argAt:2 put:doBlock. |
082a2f7d9d8e
Add #handlerProtectedBlock:inContext
Stefan Vogel <sv@exept.de>
parents:
4540
diff
changeset
|
450 |
] ifFalse:[context selector == #handle:from:do: ifTrue:[ |
082a2f7d9d8e
Add #handlerProtectedBlock:inContext
Stefan Vogel <sv@exept.de>
parents:
4540
diff
changeset
|
451 |
context argAt:3 put:doBlock. |
082a2f7d9d8e
Add #handlerProtectedBlock:inContext
Stefan Vogel <sv@exept.de>
parents:
4540
diff
changeset
|
452 |
]]. |
082a2f7d9d8e
Add #handlerProtectedBlock:inContext
Stefan Vogel <sv@exept.de>
parents:
4540
diff
changeset
|
453 |
|
082a2f7d9d8e
Add #handlerProtectedBlock:inContext
Stefan Vogel <sv@exept.de>
parents:
4540
diff
changeset
|
454 |
|
082a2f7d9d8e
Add #handlerProtectedBlock:inContext
Stefan Vogel <sv@exept.de>
parents:
4540
diff
changeset
|
455 |
|
082a2f7d9d8e
Add #handlerProtectedBlock:inContext
Stefan Vogel <sv@exept.de>
parents:
4540
diff
changeset
|
456 |
! |
082a2f7d9d8e
Add #handlerProtectedBlock:inContext
Stefan Vogel <sv@exept.de>
parents:
4540
diff
changeset
|
457 |
|
8681
38aa963476a5
Support for Block>>#on:do:on:do:
Stefan Vogel <sv@exept.de>
parents:
8384
diff
changeset
|
458 |
handles:anException |
38aa963476a5
Support for Block>>#on:do:on:do:
Stefan Vogel <sv@exept.de>
parents:
8384
diff
changeset
|
459 |
"return true, if the receiver handles the argument, anException. |
38aa963476a5
Support for Block>>#on:do:on:do:
Stefan Vogel <sv@exept.de>
parents:
8384
diff
changeset
|
460 |
(i.e. the receiver is anExceptions signal or a parent of it)" |
38aa963476a5
Support for Block>>#on:do:on:do:
Stefan Vogel <sv@exept.de>
parents:
8384
diff
changeset
|
461 |
|
38aa963476a5
Support for Block>>#on:do:on:do:
Stefan Vogel <sv@exept.de>
parents:
8384
diff
changeset
|
462 |
|signal| |
38aa963476a5
Support for Block>>#on:do:on:do:
Stefan Vogel <sv@exept.de>
parents:
8384
diff
changeset
|
463 |
|
15113
20b7764bc56a
use #creator instead of #signal
Claus Gittinger <cg@exept.de>
parents:
14961
diff
changeset
|
464 |
signal := anException creator. |
4473
793078981f01
added #handlingSignalInContext:
Claus Gittinger <cg@exept.de>
parents:
4466
diff
changeset
|
465 |
|
8681
38aa963476a5
Support for Block>>#on:do:on:do:
Stefan Vogel <sv@exept.de>
parents:
8384
diff
changeset
|
466 |
self == signal ifTrue:[^ true]. "quick check" |
38aa963476a5
Support for Block>>#on:do:on:do:
Stefan Vogel <sv@exept.de>
parents:
8384
diff
changeset
|
467 |
anException isNotification ifTrue:[^ false]. "speed up queries by not traversing the parent chain" |
38aa963476a5
Support for Block>>#on:do:on:do:
Stefan Vogel <sv@exept.de>
parents:
8384
diff
changeset
|
468 |
|
38aa963476a5
Support for Block>>#on:do:on:do:
Stefan Vogel <sv@exept.de>
parents:
8384
diff
changeset
|
469 |
[(signal := signal parent) notNil] whileTrue:[ |
38aa963476a5
Support for Block>>#on:do:on:do:
Stefan Vogel <sv@exept.de>
parents:
8384
diff
changeset
|
470 |
self == signal ifTrue:[^ true]. |
38aa963476a5
Support for Block>>#on:do:on:do:
Stefan Vogel <sv@exept.de>
parents:
8384
diff
changeset
|
471 |
]. |
38aa963476a5
Support for Block>>#on:do:on:do:
Stefan Vogel <sv@exept.de>
parents:
8384
diff
changeset
|
472 |
^ false |
4473
793078981f01
added #handlingSignalInContext:
Claus Gittinger <cg@exept.de>
parents:
4466
diff
changeset
|
473 |
! |
793078981f01
added #handlingSignalInContext:
Claus Gittinger <cg@exept.de>
parents:
4466
diff
changeset
|
474 |
|
622 | 475 |
inheritsFrom:anotherSignal |
476 |
"return true, if the receiver is a child of anotherSignal |
|
477 |
(i.e. if handling anotherSignal also handles the receiver) |
|
478 |
This is almost the same as accepts, but returns false, if |
|
479 |
the receiver is identical to anotherSignal." |
|
480 |
||
9271
6be3fa0ab53d
inheritsFrom: should not be used/redefined in the exception
Claus Gittinger <cg@exept.de>
parents:
9180
diff
changeset
|
481 |
<resource: #obsolete> |
6be3fa0ab53d
inheritsFrom: should not be used/redefined in the exception
Claus Gittinger <cg@exept.de>
parents:
9180
diff
changeset
|
482 |
|
622 | 483 |
self == anotherSignal ifTrue:[^ false]. |
484 |
^ anotherSignal accepts:self |
|
3521
4d83701cfc28
care for nil receiver in #isHandledIn:
Claus Gittinger <cg@exept.de>
parents:
3348
diff
changeset
|
485 |
|
4d83701cfc28
care for nil receiver in #isHandledIn:
Claus Gittinger <cg@exept.de>
parents:
3348
diff
changeset
|
486 |
"Modified: / 6.6.1998 / 20:37:47 / cg" |
622 | 487 |
! |
488 |
||
6200 | 489 |
isControlInterrupt |
490 |
^ false |
|
491 |
||
492 |
"Created: / 16.11.2001 / 16:12:20 / cg" |
|
493 |
! |
|
494 |
||
6631
5ffa1ce7b2cc
#isExceptionCreator instead of #isSignal
Stefan Vogel <sv@exept.de>
parents:
6518
diff
changeset
|
495 |
isExceptionCreator |
5ffa1ce7b2cc
#isExceptionCreator instead of #isSignal
Stefan Vogel <sv@exept.de>
parents:
6518
diff
changeset
|
496 |
"return true, if the receiver can create exceptions, |
5ffa1ce7b2cc
#isExceptionCreator instead of #isSignal
Stefan Vogel <sv@exept.de>
parents:
6518
diff
changeset
|
497 |
this includes #raise, #raiseRequest as well as the behavior of |
5ffa1ce7b2cc
#isExceptionCreator instead of #isSignal
Stefan Vogel <sv@exept.de>
parents:
6518
diff
changeset
|
498 |
an exception handler, such as the #accepts: and #handles: messages" |
5ffa1ce7b2cc
#isExceptionCreator instead of #isSignal
Stefan Vogel <sv@exept.de>
parents:
6518
diff
changeset
|
499 |
|
5ffa1ce7b2cc
#isExceptionCreator instead of #isSignal
Stefan Vogel <sv@exept.de>
parents:
6518
diff
changeset
|
500 |
^ true |
5ffa1ce7b2cc
#isExceptionCreator instead of #isSignal
Stefan Vogel <sv@exept.de>
parents:
6518
diff
changeset
|
501 |
! |
5ffa1ce7b2cc
#isExceptionCreator instead of #isSignal
Stefan Vogel <sv@exept.de>
parents:
6518
diff
changeset
|
502 |
|
5ffa1ce7b2cc
#isExceptionCreator instead of #isSignal
Stefan Vogel <sv@exept.de>
parents:
6518
diff
changeset
|
503 |
isExceptionHandler |
5ffa1ce7b2cc
#isExceptionCreator instead of #isSignal
Stefan Vogel <sv@exept.de>
parents:
6518
diff
changeset
|
504 |
"return true, if the receiver responds to the exception handler protocol, |
5ffa1ce7b2cc
#isExceptionCreator instead of #isSignal
Stefan Vogel <sv@exept.de>
parents:
6518
diff
changeset
|
505 |
especially to the #accepts: and #handles: messages" |
5ffa1ce7b2cc
#isExceptionCreator instead of #isSignal
Stefan Vogel <sv@exept.de>
parents:
6518
diff
changeset
|
506 |
|
5ffa1ce7b2cc
#isExceptionCreator instead of #isSignal
Stefan Vogel <sv@exept.de>
parents:
6518
diff
changeset
|
507 |
^ true |
5ffa1ce7b2cc
#isExceptionCreator instead of #isSignal
Stefan Vogel <sv@exept.de>
parents:
6518
diff
changeset
|
508 |
! |
5ffa1ce7b2cc
#isExceptionCreator instead of #isSignal
Stefan Vogel <sv@exept.de>
parents:
6518
diff
changeset
|
509 |
|
622 | 510 |
isHandled |
511 |
"return true, if there is a handler for the receiver signal. |
|
512 |
Raising an unhandled signal will usually lead into the debugger, |
|
2689 | 513 |
but can be caught globally by setting Exceptions EmergencyHandler." |
622 | 514 |
|
4676 | 515 |
^ GenericException exception:self isHandledIn:(thisContext sender). |
622 | 516 |
! |
517 |
||
518 |
isHandledIn:aContext |
|
519 |
"return true, if there is a handler for the receiver signal in the |
|
520 |
contextChain starting with aContext." |
|
521 |
||
4676 | 522 |
^ GenericException exception:self isHandledIn:aContext |
622 | 523 |
! |
524 |
||
525 |
isQuerySignal |
|
1249 | 526 |
"return true, if this is a querySignal - always return false here" |
527 |
||
622 | 528 |
^ false |
1249 | 529 |
|
530 |
"Modified: 22.4.1996 / 13:45:06 / cg" |
|
622 | 531 |
! ! |
532 |
||
533 |
!Signal methodsFor:'raising'! |
|
534 |
||
535 |
raise |
|
4438 | 536 |
"raise a signal nonproceedable. |
8685
06c1d82512f5
QuerySignal generates Notifications instead of Exceptions.
Stefan Vogel <sv@exept.de>
parents:
8681
diff
changeset
|
537 |
The signals notifierString is used as messageText." |
622 | 538 |
|
4555
892c4529acf2
cleaned up suspendedContext passing.
Claus Gittinger <cg@exept.de>
parents:
4554
diff
changeset
|
539 |
<context: #return> |
892c4529acf2
cleaned up suspendedContext passing.
Claus Gittinger <cg@exept.de>
parents:
4554
diff
changeset
|
540 |
|
13010 | 541 |
^ self newException |
542 |
raiseIn:thisContext sender |
|
1326 | 543 |
|
13010 | 544 |
"Created: / 23-07-1999 / 14:07:17 / stefan" |
545 |
"Modified: / 10-08-2010 / 09:58:57 / cg" |
|
622 | 546 |
! |
547 |
||
548 |
raiseErrorString:aString |
|
1326 | 549 |
"raise a signal nonproceedable. |
8685
06c1d82512f5
QuerySignal generates Notifications instead of Exceptions.
Stefan Vogel <sv@exept.de>
parents:
8681
diff
changeset
|
550 |
The argument is used as messageText." |
622 | 551 |
|
4555
892c4529acf2
cleaned up suspendedContext passing.
Claus Gittinger <cg@exept.de>
parents:
4554
diff
changeset
|
552 |
<context: #return> |
892c4529acf2
cleaned up suspendedContext passing.
Claus Gittinger <cg@exept.de>
parents:
4554
diff
changeset
|
553 |
|
13010 | 554 |
^ self newException |
555 |
raiseErrorString:aString in:thisContext sender |
|
1326 | 556 |
|
13010 | 557 |
"Created: / 23-07-1999 / 14:07:33 / stefan" |
558 |
"Modified: / 10-08-2010 / 09:59:22 / cg" |
|
622 | 559 |
! |
560 |
||
5685 | 561 |
raiseErrorString:aString in:aContext |
562 |
"raise a signal nonproceedable. |
|
8685
06c1d82512f5
QuerySignal generates Notifications instead of Exceptions.
Stefan Vogel <sv@exept.de>
parents:
8681
diff
changeset
|
563 |
The argument is used as messageText." |
5685 | 564 |
|
565 |
<context: #return> |
|
566 |
||
13010 | 567 |
^ self newException |
568 |
raiseErrorString:aString in:aContext |
|
5685 | 569 |
|
13010 | 570 |
"Created: / 23-07-1999 / 14:07:33 / stefan" |
571 |
"Modified: / 10-08-2010 / 09:59:58 / cg" |
|
5685 | 572 |
! |
573 |
||
8685
06c1d82512f5
QuerySignal generates Notifications instead of Exceptions.
Stefan Vogel <sv@exept.de>
parents:
8681
diff
changeset
|
574 |
raiseFrom:something |
1326 | 575 |
"raise a signal nonproceedable. |
4438 | 576 |
The argument, something is passed both as parameter and originator." |
8685
06c1d82512f5
QuerySignal generates Notifications instead of Exceptions.
Stefan Vogel <sv@exept.de>
parents:
8681
diff
changeset
|
577 |
|
4555
892c4529acf2
cleaned up suspendedContext passing.
Claus Gittinger <cg@exept.de>
parents:
4554
diff
changeset
|
578 |
<context: #return> |
892c4529acf2
cleaned up suspendedContext passing.
Claus Gittinger <cg@exept.de>
parents:
4554
diff
changeset
|
579 |
|
8730 | 580 |
^ (self newException |
13010 | 581 |
suspendedContext:(thisContext sender) parameter:something originator:something) |
4540
4b99a82fe85a
suspendedContext setup explicit
Claus Gittinger <cg@exept.de>
parents:
4527
diff
changeset
|
582 |
raise |
1326 | 583 |
|
13010 | 584 |
"Created: / 23-07-1999 / 14:07:59 / stefan" |
585 |
"Modified: / 10-08-2010 / 09:58:36 / cg" |
|
622 | 586 |
! |
587 |
||
588 |
raiseRequest |
|
1326 | 589 |
"raise a signal proceedable. |
8685
06c1d82512f5
QuerySignal generates Notifications instead of Exceptions.
Stefan Vogel <sv@exept.de>
parents:
8681
diff
changeset
|
590 |
The signals notifierString is used as messageText." |
622 | 591 |
|
4555
892c4529acf2
cleaned up suspendedContext passing.
Claus Gittinger <cg@exept.de>
parents:
4554
diff
changeset
|
592 |
<context: #return> |
892c4529acf2
cleaned up suspendedContext passing.
Claus Gittinger <cg@exept.de>
parents:
4554
diff
changeset
|
593 |
|
13010 | 594 |
^ self newException |
595 |
raiseRequestIn:thisContext sender |
|
1326 | 596 |
|
13010 | 597 |
"Created: / 23-07-1999 / 14:08:24 / stefan" |
598 |
"Modified: / 10-08-2010 / 10:00:13 / cg" |
|
622 | 599 |
! |
600 |
||
4759
99d883e67ec9
added #raiseRequestErrorString
Claus Gittinger <cg@exept.de>
parents:
4676
diff
changeset
|
601 |
raiseRequestErrorString:aString |
99d883e67ec9
added #raiseRequestErrorString
Claus Gittinger <cg@exept.de>
parents:
4676
diff
changeset
|
602 |
"raise a signal proceedable. |
8685
06c1d82512f5
QuerySignal generates Notifications instead of Exceptions.
Stefan Vogel <sv@exept.de>
parents:
8681
diff
changeset
|
603 |
The argument, aString is used as messageText." |
4759
99d883e67ec9
added #raiseRequestErrorString
Claus Gittinger <cg@exept.de>
parents:
4676
diff
changeset
|
604 |
|
99d883e67ec9
added #raiseRequestErrorString
Claus Gittinger <cg@exept.de>
parents:
4676
diff
changeset
|
605 |
<context: #return> |
99d883e67ec9
added #raiseRequestErrorString
Claus Gittinger <cg@exept.de>
parents:
4676
diff
changeset
|
606 |
|
13010 | 607 |
^ self newException |
608 |
raiseRequestErrorString:aString in:thisContext sender |
|
609 |
||
610 |
"Modified: / 10-08-2010 / 10:00:40 / cg" |
|
8685
06c1d82512f5
QuerySignal generates Notifications instead of Exceptions.
Stefan Vogel <sv@exept.de>
parents:
8681
diff
changeset
|
611 |
! |
06c1d82512f5
QuerySignal generates Notifications instead of Exceptions.
Stefan Vogel <sv@exept.de>
parents:
8681
diff
changeset
|
612 |
|
06c1d82512f5
QuerySignal generates Notifications instead of Exceptions.
Stefan Vogel <sv@exept.de>
parents:
8681
diff
changeset
|
613 |
raiseRequestFrom:something |
06c1d82512f5
QuerySignal generates Notifications instead of Exceptions.
Stefan Vogel <sv@exept.de>
parents:
8681
diff
changeset
|
614 |
"raise a signal proceedable. |
06c1d82512f5
QuerySignal generates Notifications instead of Exceptions.
Stefan Vogel <sv@exept.de>
parents:
8681
diff
changeset
|
615 |
The argument, something is passed both as parameter and originator." |
06c1d82512f5
QuerySignal generates Notifications instead of Exceptions.
Stefan Vogel <sv@exept.de>
parents:
8681
diff
changeset
|
616 |
|
06c1d82512f5
QuerySignal generates Notifications instead of Exceptions.
Stefan Vogel <sv@exept.de>
parents:
8681
diff
changeset
|
617 |
<context: #return> |
06c1d82512f5
QuerySignal generates Notifications instead of Exceptions.
Stefan Vogel <sv@exept.de>
parents:
8681
diff
changeset
|
618 |
|
8730 | 619 |
^ (self newException |
620 |
suspendedContext:(thisContext sender) parameter:something originator:something) |
|
8685
06c1d82512f5
QuerySignal generates Notifications instead of Exceptions.
Stefan Vogel <sv@exept.de>
parents:
8681
diff
changeset
|
621 |
raiseRequest |
06c1d82512f5
QuerySignal generates Notifications instead of Exceptions.
Stefan Vogel <sv@exept.de>
parents:
8681
diff
changeset
|
622 |
|
06c1d82512f5
QuerySignal generates Notifications instead of Exceptions.
Stefan Vogel <sv@exept.de>
parents:
8681
diff
changeset
|
623 |
"Modified: / 2.5.1996 / 16:36:38 / cg" |
06c1d82512f5
QuerySignal generates Notifications instead of Exceptions.
Stefan Vogel <sv@exept.de>
parents:
8681
diff
changeset
|
624 |
"Modified: / 5.3.1998 / 16:52:46 / stefan" |
06c1d82512f5
QuerySignal generates Notifications instead of Exceptions.
Stefan Vogel <sv@exept.de>
parents:
8681
diff
changeset
|
625 |
"Created: / 23.7.1999 / 14:08:36 / stefan" |
06c1d82512f5
QuerySignal generates Notifications instead of Exceptions.
Stefan Vogel <sv@exept.de>
parents:
8681
diff
changeset
|
626 |
! |
06c1d82512f5
QuerySignal generates Notifications instead of Exceptions.
Stefan Vogel <sv@exept.de>
parents:
8681
diff
changeset
|
627 |
|
06c1d82512f5
QuerySignal generates Notifications instead of Exceptions.
Stefan Vogel <sv@exept.de>
parents:
8681
diff
changeset
|
628 |
raiseRequestWith:aParameter |
06c1d82512f5
QuerySignal generates Notifications instead of Exceptions.
Stefan Vogel <sv@exept.de>
parents:
8681
diff
changeset
|
629 |
"raise a signal proceedable. |
06c1d82512f5
QuerySignal generates Notifications instead of Exceptions.
Stefan Vogel <sv@exept.de>
parents:
8681
diff
changeset
|
630 |
The signals notifierString is used as messageText." |
06c1d82512f5
QuerySignal generates Notifications instead of Exceptions.
Stefan Vogel <sv@exept.de>
parents:
8681
diff
changeset
|
631 |
|
06c1d82512f5
QuerySignal generates Notifications instead of Exceptions.
Stefan Vogel <sv@exept.de>
parents:
8681
diff
changeset
|
632 |
<context: #return> |
06c1d82512f5
QuerySignal generates Notifications instead of Exceptions.
Stefan Vogel <sv@exept.de>
parents:
8681
diff
changeset
|
633 |
|
13010 | 634 |
^ self newException |
635 |
raiseRequestWith:aParameter in:thisContext sender |
|
8685
06c1d82512f5
QuerySignal generates Notifications instead of Exceptions.
Stefan Vogel <sv@exept.de>
parents:
8681
diff
changeset
|
636 |
|
13010 | 637 |
"Created: / 23-07-1999 / 14:08:48 / stefan" |
638 |
"Modified: / 10-08-2010 / 10:01:00 / cg" |
|
8685
06c1d82512f5
QuerySignal generates Notifications instead of Exceptions.
Stefan Vogel <sv@exept.de>
parents:
8681
diff
changeset
|
639 |
! |
06c1d82512f5
QuerySignal generates Notifications instead of Exceptions.
Stefan Vogel <sv@exept.de>
parents:
8681
diff
changeset
|
640 |
|
06c1d82512f5
QuerySignal generates Notifications instead of Exceptions.
Stefan Vogel <sv@exept.de>
parents:
8681
diff
changeset
|
641 |
raiseRequestWith:aParameter errorString:aString |
06c1d82512f5
QuerySignal generates Notifications instead of Exceptions.
Stefan Vogel <sv@exept.de>
parents:
8681
diff
changeset
|
642 |
"raise a signal proceedable. |
06c1d82512f5
QuerySignal generates Notifications instead of Exceptions.
Stefan Vogel <sv@exept.de>
parents:
8681
diff
changeset
|
643 |
The argument, aString is used as messageText." |
06c1d82512f5
QuerySignal generates Notifications instead of Exceptions.
Stefan Vogel <sv@exept.de>
parents:
8681
diff
changeset
|
644 |
|
06c1d82512f5
QuerySignal generates Notifications instead of Exceptions.
Stefan Vogel <sv@exept.de>
parents:
8681
diff
changeset
|
645 |
<context: #return> |
06c1d82512f5
QuerySignal generates Notifications instead of Exceptions.
Stefan Vogel <sv@exept.de>
parents:
8681
diff
changeset
|
646 |
|
13010 | 647 |
^ self newException |
648 |
raiseRequestWith:aParameter errorString:aString in:thisContext sender |
|
4759
99d883e67ec9
added #raiseRequestErrorString
Claus Gittinger <cg@exept.de>
parents:
4676
diff
changeset
|
649 |
|
13010 | 650 |
"Created: / 23-07-1999 / 14:08:57 / stefan" |
651 |
"Modified: / 10-08-2010 / 10:01:38 / cg" |
|
4759
99d883e67ec9
added #raiseRequestErrorString
Claus Gittinger <cg@exept.de>
parents:
4676
diff
changeset
|
652 |
! |
99d883e67ec9
added #raiseRequestErrorString
Claus Gittinger <cg@exept.de>
parents:
4676
diff
changeset
|
653 |
|
8685
06c1d82512f5
QuerySignal generates Notifications instead of Exceptions.
Stefan Vogel <sv@exept.de>
parents:
8681
diff
changeset
|
654 |
raiseRequestWith:aParameter errorString:aString in:aContext |
3103 | 655 |
"raise a signal proceedable. |
8685
06c1d82512f5
QuerySignal generates Notifications instead of Exceptions.
Stefan Vogel <sv@exept.de>
parents:
8681
diff
changeset
|
656 |
The argument, aString is used as messageText. |
06c1d82512f5
QuerySignal generates Notifications instead of Exceptions.
Stefan Vogel <sv@exept.de>
parents:
8681
diff
changeset
|
657 |
The additional context is passed as the context responsible for the raise, |
06c1d82512f5
QuerySignal generates Notifications instead of Exceptions.
Stefan Vogel <sv@exept.de>
parents:
8681
diff
changeset
|
658 |
allowing a raise to mimicri the exception happened somewhere else." |
4555
892c4529acf2
cleaned up suspendedContext passing.
Claus Gittinger <cg@exept.de>
parents:
4554
diff
changeset
|
659 |
|
8732 | 660 |
<context: #return> |
661 |
||
13010 | 662 |
^ self newException |
663 |
raiseRequestWith:aParameter errorString:aString in:aContext |
|
3103 | 664 |
|
13010 | 665 |
"Created: / 23-07-1999 / 14:09:07 / stefan" |
666 |
"Modified: / 10-08-2010 / 10:02:08 / cg" |
|
3103 | 667 |
! |
668 |
||
8685
06c1d82512f5
QuerySignal generates Notifications instead of Exceptions.
Stefan Vogel <sv@exept.de>
parents:
8681
diff
changeset
|
669 |
raiseRequestWith:aParameter in:aContext |
1326 | 670 |
"raise a signal proceedable. |
8685
06c1d82512f5
QuerySignal generates Notifications instead of Exceptions.
Stefan Vogel <sv@exept.de>
parents:
8681
diff
changeset
|
671 |
The additional context is passed as the context responsible for the raise, |
06c1d82512f5
QuerySignal generates Notifications instead of Exceptions.
Stefan Vogel <sv@exept.de>
parents:
8681
diff
changeset
|
672 |
allowing a raise to mimicri the exception happened somewhere else." |
06c1d82512f5
QuerySignal generates Notifications instead of Exceptions.
Stefan Vogel <sv@exept.de>
parents:
8681
diff
changeset
|
673 |
|
8732 | 674 |
<context: #return> |
675 |
||
13010 | 676 |
^ self newException |
677 |
raiseRequestWith:aParameter in:aContext |
|
678 |
||
679 |
"Modified: / 10-08-2010 / 10:02:26 / cg" |
|
8685
06c1d82512f5
QuerySignal generates Notifications instead of Exceptions.
Stefan Vogel <sv@exept.de>
parents:
8681
diff
changeset
|
680 |
! |
06c1d82512f5
QuerySignal generates Notifications instead of Exceptions.
Stefan Vogel <sv@exept.de>
parents:
8681
diff
changeset
|
681 |
|
06c1d82512f5
QuerySignal generates Notifications instead of Exceptions.
Stefan Vogel <sv@exept.de>
parents:
8681
diff
changeset
|
682 |
raiseSignal |
06c1d82512f5
QuerySignal generates Notifications instead of Exceptions.
Stefan Vogel <sv@exept.de>
parents:
8681
diff
changeset
|
683 |
"raise a signal (proceedable or not, whatever the proceedability is). |
06c1d82512f5
QuerySignal generates Notifications instead of Exceptions.
Stefan Vogel <sv@exept.de>
parents:
8681
diff
changeset
|
684 |
The signals notifierString is used as messageText." |
622 | 685 |
|
4555
892c4529acf2
cleaned up suspendedContext passing.
Claus Gittinger <cg@exept.de>
parents:
4554
diff
changeset
|
686 |
<context: #return> |
892c4529acf2
cleaned up suspendedContext passing.
Claus Gittinger <cg@exept.de>
parents:
4554
diff
changeset
|
687 |
|
8730 | 688 |
^ (self newException |
689 |
suspendedContext:thisContext sender) |
|
8685
06c1d82512f5
QuerySignal generates Notifications instead of Exceptions.
Stefan Vogel <sv@exept.de>
parents:
8681
diff
changeset
|
690 |
raiseSignal |
1326 | 691 |
|
8685
06c1d82512f5
QuerySignal generates Notifications instead of Exceptions.
Stefan Vogel <sv@exept.de>
parents:
8681
diff
changeset
|
692 |
"Modified: / 10.11.2001 / 15:13:34 / cg" |
622 | 693 |
! |
694 |
||
8685
06c1d82512f5
QuerySignal generates Notifications instead of Exceptions.
Stefan Vogel <sv@exept.de>
parents:
8681
diff
changeset
|
695 |
raiseSignal:errorMessage |
06c1d82512f5
QuerySignal generates Notifications instead of Exceptions.
Stefan Vogel <sv@exept.de>
parents:
8681
diff
changeset
|
696 |
"ANSI: raise a signal (proceedable or not, whatever the proceedability is). |
06c1d82512f5
QuerySignal generates Notifications instead of Exceptions.
Stefan Vogel <sv@exept.de>
parents:
8681
diff
changeset
|
697 |
The argument, errorMessage is used as messageText." |
06c1d82512f5
QuerySignal generates Notifications instead of Exceptions.
Stefan Vogel <sv@exept.de>
parents:
8681
diff
changeset
|
698 |
|
06c1d82512f5
QuerySignal generates Notifications instead of Exceptions.
Stefan Vogel <sv@exept.de>
parents:
8681
diff
changeset
|
699 |
<context: #return> |
06c1d82512f5
QuerySignal generates Notifications instead of Exceptions.
Stefan Vogel <sv@exept.de>
parents:
8681
diff
changeset
|
700 |
|
8730 | 701 |
^ (self newException |
702 |
suspendedContext:(thisContext sender) errorString:errorMessage) |
|
8685
06c1d82512f5
QuerySignal generates Notifications instead of Exceptions.
Stefan Vogel <sv@exept.de>
parents:
8681
diff
changeset
|
703 |
raiseSignal. |
06c1d82512f5
QuerySignal generates Notifications instead of Exceptions.
Stefan Vogel <sv@exept.de>
parents:
8681
diff
changeset
|
704 |
|
06c1d82512f5
QuerySignal generates Notifications instead of Exceptions.
Stefan Vogel <sv@exept.de>
parents:
8681
diff
changeset
|
705 |
"Modified: / 07-08-2004 / 19:24:00 / stefan" |
06c1d82512f5
QuerySignal generates Notifications instead of Exceptions.
Stefan Vogel <sv@exept.de>
parents:
8681
diff
changeset
|
706 |
! |
06c1d82512f5
QuerySignal generates Notifications instead of Exceptions.
Stefan Vogel <sv@exept.de>
parents:
8681
diff
changeset
|
707 |
|
06c1d82512f5
QuerySignal generates Notifications instead of Exceptions.
Stefan Vogel <sv@exept.de>
parents:
8681
diff
changeset
|
708 |
raiseSignal:errorMessage with:aParameter |
06c1d82512f5
QuerySignal generates Notifications instead of Exceptions.
Stefan Vogel <sv@exept.de>
parents:
8681
diff
changeset
|
709 |
"ANSI: raise a signal (proceedable or not, whatever the proceedability is). |
06c1d82512f5
QuerySignal generates Notifications instead of Exceptions.
Stefan Vogel <sv@exept.de>
parents:
8681
diff
changeset
|
710 |
The argument, errorMessage is used as messageText." |
622 | 711 |
|
4555
892c4529acf2
cleaned up suspendedContext passing.
Claus Gittinger <cg@exept.de>
parents:
4554
diff
changeset
|
712 |
<context: #return> |
892c4529acf2
cleaned up suspendedContext passing.
Claus Gittinger <cg@exept.de>
parents:
4554
diff
changeset
|
713 |
|
8730 | 714 |
^ (self newException |
715 |
suspendedContext:(thisContext sender) parameter:aParameter errorString:errorMessage) |
|
8685
06c1d82512f5
QuerySignal generates Notifications instead of Exceptions.
Stefan Vogel <sv@exept.de>
parents:
8681
diff
changeset
|
716 |
raiseSignal. |
06c1d82512f5
QuerySignal generates Notifications instead of Exceptions.
Stefan Vogel <sv@exept.de>
parents:
8681
diff
changeset
|
717 |
|
06c1d82512f5
QuerySignal generates Notifications instead of Exceptions.
Stefan Vogel <sv@exept.de>
parents:
8681
diff
changeset
|
718 |
"Modified: / 07-08-2004 / 19:10:40 / stefan" |
06c1d82512f5
QuerySignal generates Notifications instead of Exceptions.
Stefan Vogel <sv@exept.de>
parents:
8681
diff
changeset
|
719 |
! |
1326 | 720 |
|
8685
06c1d82512f5
QuerySignal generates Notifications instead of Exceptions.
Stefan Vogel <sv@exept.de>
parents:
8681
diff
changeset
|
721 |
raiseSignalErrorString:aString |
06c1d82512f5
QuerySignal generates Notifications instead of Exceptions.
Stefan Vogel <sv@exept.de>
parents:
8681
diff
changeset
|
722 |
"raise a signal (proceedable or not, whatever the proceedability is). |
06c1d82512f5
QuerySignal generates Notifications instead of Exceptions.
Stefan Vogel <sv@exept.de>
parents:
8681
diff
changeset
|
723 |
The argument, aString is used as messageText." |
06c1d82512f5
QuerySignal generates Notifications instead of Exceptions.
Stefan Vogel <sv@exept.de>
parents:
8681
diff
changeset
|
724 |
|
06c1d82512f5
QuerySignal generates Notifications instead of Exceptions.
Stefan Vogel <sv@exept.de>
parents:
8681
diff
changeset
|
725 |
<context: #return> |
06c1d82512f5
QuerySignal generates Notifications instead of Exceptions.
Stefan Vogel <sv@exept.de>
parents:
8681
diff
changeset
|
726 |
|
8730 | 727 |
^ (self newException |
728 |
suspendedContext:(thisContext sender) errorString:aString) |
|
8685
06c1d82512f5
QuerySignal generates Notifications instead of Exceptions.
Stefan Vogel <sv@exept.de>
parents:
8681
diff
changeset
|
729 |
raiseSignal. |
622 | 730 |
! |
731 |
||
8685
06c1d82512f5
QuerySignal generates Notifications instead of Exceptions.
Stefan Vogel <sv@exept.de>
parents:
8681
diff
changeset
|
732 |
raiseSignalWith:aParameter |
06c1d82512f5
QuerySignal generates Notifications instead of Exceptions.
Stefan Vogel <sv@exept.de>
parents:
8681
diff
changeset
|
733 |
"raise a signal (proceedable or not, whatever the proceedability is). |
06c1d82512f5
QuerySignal generates Notifications instead of Exceptions.
Stefan Vogel <sv@exept.de>
parents:
8681
diff
changeset
|
734 |
The argument, aParameter is passed as parameter." |
06c1d82512f5
QuerySignal generates Notifications instead of Exceptions.
Stefan Vogel <sv@exept.de>
parents:
8681
diff
changeset
|
735 |
|
06c1d82512f5
QuerySignal generates Notifications instead of Exceptions.
Stefan Vogel <sv@exept.de>
parents:
8681
diff
changeset
|
736 |
<context: #return> |
06c1d82512f5
QuerySignal generates Notifications instead of Exceptions.
Stefan Vogel <sv@exept.de>
parents:
8681
diff
changeset
|
737 |
|
8730 | 738 |
^ (self newException |
739 |
suspendedContext:(thisContext sender) parameter:aParameter) |
|
8685
06c1d82512f5
QuerySignal generates Notifications instead of Exceptions.
Stefan Vogel <sv@exept.de>
parents:
8681
diff
changeset
|
740 |
raiseSignal. |
06c1d82512f5
QuerySignal generates Notifications instead of Exceptions.
Stefan Vogel <sv@exept.de>
parents:
8681
diff
changeset
|
741 |
! |
622 | 742 |
|
8685
06c1d82512f5
QuerySignal generates Notifications instead of Exceptions.
Stefan Vogel <sv@exept.de>
parents:
8681
diff
changeset
|
743 |
raiseSignalWith:aParameter errorString:aString |
06c1d82512f5
QuerySignal generates Notifications instead of Exceptions.
Stefan Vogel <sv@exept.de>
parents:
8681
diff
changeset
|
744 |
"raise a signal (proceedable or not, whatever the proceedability is). |
06c1d82512f5
QuerySignal generates Notifications instead of Exceptions.
Stefan Vogel <sv@exept.de>
parents:
8681
diff
changeset
|
745 |
The argument, aString is used as messageText, |
06c1d82512f5
QuerySignal generates Notifications instead of Exceptions.
Stefan Vogel <sv@exept.de>
parents:
8681
diff
changeset
|
746 |
aParameter is passed as exception parameter." |
1326 | 747 |
|
8685
06c1d82512f5
QuerySignal generates Notifications instead of Exceptions.
Stefan Vogel <sv@exept.de>
parents:
8681
diff
changeset
|
748 |
<context: #return> |
06c1d82512f5
QuerySignal generates Notifications instead of Exceptions.
Stefan Vogel <sv@exept.de>
parents:
8681
diff
changeset
|
749 |
|
8730 | 750 |
^ (self newException |
751 |
suspendedContext:(thisContext sender) parameter:aParameter errorString:aString) |
|
8685
06c1d82512f5
QuerySignal generates Notifications instead of Exceptions.
Stefan Vogel <sv@exept.de>
parents:
8681
diff
changeset
|
752 |
raiseSignal. |
622 | 753 |
! |
754 |
||
755 |
raiseWith:aParameter |
|
1326 | 756 |
"raise a signal nonproceedable. |
4438 | 757 |
The argument, aParameter is passed as parameter." |
622 | 758 |
|
4555
892c4529acf2
cleaned up suspendedContext passing.
Claus Gittinger <cg@exept.de>
parents:
4554
diff
changeset
|
759 |
<context: #return> |
892c4529acf2
cleaned up suspendedContext passing.
Claus Gittinger <cg@exept.de>
parents:
4554
diff
changeset
|
760 |
|
13010 | 761 |
^ self newException |
762 |
raiseWith:aParameter in:thisContext sender |
|
1326 | 763 |
|
13010 | 764 |
"Created: / 23-07-1999 / 14:09:27 / stefan" |
765 |
"Modified: / 10-08-2010 / 10:02:51 / cg" |
|
622 | 766 |
! |
767 |
||
768 |
raiseWith:aParameter errorString:aString |
|
4438 | 769 |
"raise a signal nonproceedable. |
8685
06c1d82512f5
QuerySignal generates Notifications instead of Exceptions.
Stefan Vogel <sv@exept.de>
parents:
8681
diff
changeset
|
770 |
The argument, aString is used as messageText, |
06c1d82512f5
QuerySignal generates Notifications instead of Exceptions.
Stefan Vogel <sv@exept.de>
parents:
8681
diff
changeset
|
771 |
aParameter is passed as exception parameter." |
622 | 772 |
|
4555
892c4529acf2
cleaned up suspendedContext passing.
Claus Gittinger <cg@exept.de>
parents:
4554
diff
changeset
|
773 |
<context: #return> |
892c4529acf2
cleaned up suspendedContext passing.
Claus Gittinger <cg@exept.de>
parents:
4554
diff
changeset
|
774 |
|
13010 | 775 |
^ self newException |
776 |
raiseWith:aParameter errorString:aString in:thisContext sender |
|
1326 | 777 |
|
13010 | 778 |
"Created: / 23-07-1999 / 14:09:36 / stefan" |
779 |
"Modified: / 10-08-2010 / 10:03:29 / cg" |
|
1326 | 780 |
! |
781 |
||
782 |
raiseWith:aParameter errorString:aString in:aContext |
|
4438 | 783 |
"raise a signal nonproceedable. |
8685
06c1d82512f5
QuerySignal generates Notifications instead of Exceptions.
Stefan Vogel <sv@exept.de>
parents:
8681
diff
changeset
|
784 |
The argument, aString is used as messageText, aParameter is passed |
1608 | 785 |
as exception parameter. |
786 |
The additional context is passed as the context responsible for the raise, |
|
787 |
allowing a raise to mimicri the exception happened somewhere else." |
|
788 |
||
8732 | 789 |
<context: #return> |
790 |
||
13010 | 791 |
^ self newException |
792 |
raiseWith:aParameter errorString:aString in:aContext |
|
1326 | 793 |
|
13010 | 794 |
"Created: / 23-07-1999 / 14:09:46 / stefan" |
795 |
"Modified: / 10-08-2010 / 10:03:19 / cg" |
|
8685
06c1d82512f5
QuerySignal generates Notifications instead of Exceptions.
Stefan Vogel <sv@exept.de>
parents:
8681
diff
changeset
|
796 |
! |
06c1d82512f5
QuerySignal generates Notifications instead of Exceptions.
Stefan Vogel <sv@exept.de>
parents:
8681
diff
changeset
|
797 |
|
9180 | 798 |
raiseWith:aParameter in:aContext |
799 |
"raise a signal nonproceedable. |
|
800 |
The argument, aParameter is passed as parameter. |
|
801 |
The additional context is passed as the context responsible for the raise, |
|
802 |
allowing a raise to mimicri the exception happened somewhere else." |
|
803 |
||
804 |
<context: #return> |
|
805 |
||
13010 | 806 |
^ self newException |
807 |
raiseWith:aParameter in:aContext |
|
808 |
||
809 |
"Modified: / 10-08-2010 / 10:03:05 / cg" |
|
622 | 810 |
! ! |
811 |
||
1 | 812 |
!Signal methodsFor:'save evaluation'! |
813 |
||
622 | 814 |
catch:aBlock |
6396
74d5b0b588a6
added deferAfter: - defer exceptions until some later time
Claus Gittinger <cg@exept.de>
parents:
6200
diff
changeset
|
815 |
"evaluate the argument, aBlock. |
74d5b0b588a6
added deferAfter: - defer exceptions until some later time
Claus Gittinger <cg@exept.de>
parents:
6200
diff
changeset
|
816 |
If the receiver-signal is raised during evaluation, abort |
74d5b0b588a6
added deferAfter: - defer exceptions until some later time
Claus Gittinger <cg@exept.de>
parents:
6200
diff
changeset
|
817 |
the evaluation and return true; otherwise return false. |
74d5b0b588a6
added deferAfter: - defer exceptions until some later time
Claus Gittinger <cg@exept.de>
parents:
6200
diff
changeset
|
818 |
This is the catch & throw mechanism found in other languages, |
74d5b0b588a6
added deferAfter: - defer exceptions until some later time
Claus Gittinger <cg@exept.de>
parents:
6200
diff
changeset
|
819 |
where the returned value indicates if an exception occured." |
74d5b0b588a6
added deferAfter: - defer exceptions until some later time
Claus Gittinger <cg@exept.de>
parents:
6200
diff
changeset
|
820 |
|
9079 | 821 |
|raiseOccurred| |
6396
74d5b0b588a6
added deferAfter: - defer exceptions until some later time
Claus Gittinger <cg@exept.de>
parents:
6200
diff
changeset
|
822 |
|
9079 | 823 |
raiseOccurred := false. |
824 |
self handle:[:ex | raiseOccurred := true. ex return] do:aBlock. |
|
825 |
^ raiseOccurred |
|
622 | 826 |
|
9079 | 827 |
" |
828 |
Object messageNotUnderstoodSignal catch:[ |
|
829 |
123 size open |
|
830 |
] |
|
831 |
" |
|
6396
74d5b0b588a6
added deferAfter: - defer exceptions until some later time
Claus Gittinger <cg@exept.de>
parents:
6200
diff
changeset
|
832 |
! |
74d5b0b588a6
added deferAfter: - defer exceptions until some later time
Claus Gittinger <cg@exept.de>
parents:
6200
diff
changeset
|
833 |
|
74d5b0b588a6
added deferAfter: - defer exceptions until some later time
Claus Gittinger <cg@exept.de>
parents:
6200
diff
changeset
|
834 |
deferAfter:aBlock |
12006 | 835 |
" evaluate the argument, aBlock. |
6396
74d5b0b588a6
added deferAfter: - defer exceptions until some later time
Claus Gittinger <cg@exept.de>
parents:
6200
diff
changeset
|
836 |
Ignore the receiver-signal during evaluation - i.e. simply continue, |
74d5b0b588a6
added deferAfter: - defer exceptions until some later time
Claus Gittinger <cg@exept.de>
parents:
6200
diff
changeset
|
837 |
but remember if the signal was raised. |
74d5b0b588a6
added deferAfter: - defer exceptions until some later time
Claus Gittinger <cg@exept.de>
parents:
6200
diff
changeset
|
838 |
After the block evaluation, finally raise the signal - if it was raised in the block. |
74d5b0b588a6
added deferAfter: - defer exceptions until some later time
Claus Gittinger <cg@exept.de>
parents:
6200
diff
changeset
|
839 |
If the signal is raised multiple times, only the first raises parameter is remembered, |
74d5b0b588a6
added deferAfter: - defer exceptions until some later time
Claus Gittinger <cg@exept.de>
parents:
6200
diff
changeset
|
840 |
and only a single raise is performed after the blocks evaluation. |
622 | 841 |
|
6396
74d5b0b588a6
added deferAfter: - defer exceptions until some later time
Claus Gittinger <cg@exept.de>
parents:
6200
diff
changeset
|
842 |
Deferring makes sense for some signals, such as UserInterrupt or AbortSignal, |
12005 | 843 |
which must occasionally be delayed temporarily until a save place is reached |
6396
74d5b0b588a6
added deferAfter: - defer exceptions until some later time
Claus Gittinger <cg@exept.de>
parents:
6200
diff
changeset
|
844 |
(especially when packages are sent across a communication channel, and you dont want |
74d5b0b588a6
added deferAfter: - defer exceptions until some later time
Claus Gittinger <cg@exept.de>
parents:
6200
diff
changeset
|
845 |
partial packages to be generated by user interruptions)." |
74d5b0b588a6
added deferAfter: - defer exceptions until some later time
Claus Gittinger <cg@exept.de>
parents:
6200
diff
changeset
|
846 |
|
6429
d0a5a78e6227
better impl. of #deferAfter:
Claus Gittinger <cg@exept.de>
parents:
6396
diff
changeset
|
847 |
|coughtException result| |
622 | 848 |
|
6396
74d5b0b588a6
added deferAfter: - defer exceptions until some later time
Claus Gittinger <cg@exept.de>
parents:
6200
diff
changeset
|
849 |
self handle:[:ex | |
6429
d0a5a78e6227
better impl. of #deferAfter:
Claus Gittinger <cg@exept.de>
parents:
6396
diff
changeset
|
850 |
coughtException isNil ifTrue:[ |
d0a5a78e6227
better impl. of #deferAfter:
Claus Gittinger <cg@exept.de>
parents:
6396
diff
changeset
|
851 |
coughtException := ex. |
6396
74d5b0b588a6
added deferAfter: - defer exceptions until some later time
Claus Gittinger <cg@exept.de>
parents:
6200
diff
changeset
|
852 |
]. |
74d5b0b588a6
added deferAfter: - defer exceptions until some later time
Claus Gittinger <cg@exept.de>
parents:
6200
diff
changeset
|
853 |
ex proceedWith:nil |
74d5b0b588a6
added deferAfter: - defer exceptions until some later time
Claus Gittinger <cg@exept.de>
parents:
6200
diff
changeset
|
854 |
] do:[ |
74d5b0b588a6
added deferAfter: - defer exceptions until some later time
Claus Gittinger <cg@exept.de>
parents:
6200
diff
changeset
|
855 |
result := aBlock value. |
74d5b0b588a6
added deferAfter: - defer exceptions until some later time
Claus Gittinger <cg@exept.de>
parents:
6200
diff
changeset
|
856 |
]. |
6429
d0a5a78e6227
better impl. of #deferAfter:
Claus Gittinger <cg@exept.de>
parents:
6396
diff
changeset
|
857 |
coughtException notNil ifTrue:[ |
d0a5a78e6227
better impl. of #deferAfter:
Claus Gittinger <cg@exept.de>
parents:
6396
diff
changeset
|
858 |
coughtException suspendedContext:thisContext. |
d0a5a78e6227
better impl. of #deferAfter:
Claus Gittinger <cg@exept.de>
parents:
6396
diff
changeset
|
859 |
|
d0a5a78e6227
better impl. of #deferAfter:
Claus Gittinger <cg@exept.de>
parents:
6396
diff
changeset
|
860 |
"/ the signal was raised during the execution of aBlock above. |
d0a5a78e6227
better impl. of #deferAfter:
Claus Gittinger <cg@exept.de>
parents:
6396
diff
changeset
|
861 |
"/ Raise it now (delayed). |
d0a5a78e6227
better impl. of #deferAfter:
Claus Gittinger <cg@exept.de>
parents:
6396
diff
changeset
|
862 |
coughtException raiseSignal |
6396
74d5b0b588a6
added deferAfter: - defer exceptions until some later time
Claus Gittinger <cg@exept.de>
parents:
6200
diff
changeset
|
863 |
]. |
74d5b0b588a6
added deferAfter: - defer exceptions until some later time
Claus Gittinger <cg@exept.de>
parents:
6200
diff
changeset
|
864 |
^ result |
74d5b0b588a6
added deferAfter: - defer exceptions until some later time
Claus Gittinger <cg@exept.de>
parents:
6200
diff
changeset
|
865 |
|
74d5b0b588a6
added deferAfter: - defer exceptions until some later time
Claus Gittinger <cg@exept.de>
parents:
6200
diff
changeset
|
866 |
" |
6429
d0a5a78e6227
better impl. of #deferAfter:
Claus Gittinger <cg@exept.de>
parents:
6396
diff
changeset
|
867 |
|s| |
d0a5a78e6227
better impl. of #deferAfter:
Claus Gittinger <cg@exept.de>
parents:
6396
diff
changeset
|
868 |
|
d0a5a78e6227
better impl. of #deferAfter:
Claus Gittinger <cg@exept.de>
parents:
6396
diff
changeset
|
869 |
s := Signal new mayProceed:true. |
d0a5a78e6227
better impl. of #deferAfter:
Claus Gittinger <cg@exept.de>
parents:
6396
diff
changeset
|
870 |
s deferAfter:[ |
d0a5a78e6227
better impl. of #deferAfter:
Claus Gittinger <cg@exept.de>
parents:
6396
diff
changeset
|
871 |
s raiseRequestWith:'hello' errorString:'eeee' |
6396
74d5b0b588a6
added deferAfter: - defer exceptions until some later time
Claus Gittinger <cg@exept.de>
parents:
6200
diff
changeset
|
872 |
] |
74d5b0b588a6
added deferAfter: - defer exceptions until some later time
Claus Gittinger <cg@exept.de>
parents:
6200
diff
changeset
|
873 |
" |
622 | 874 |
! |
875 |
||
12062 | 876 |
evaluate:aBlock ifRaised:exceptionValue |
877 |
"evaluate the argument, aBlock and return its value. |
|
878 |
If the receiver-signal is raised during evaluation, abort |
|
879 |
the evaluation and return the value from exceptionValue. |
|
880 |
This is similar to the catch & throw mechanism found in other languages" |
|
881 |
||
882 |
^ self handle:[:ex | exceptionValue value] do:aBlock. |
|
883 |
||
884 |
" |
|
885 |
Object messageNotUnderstoodSignal |
|
886 |
evaluate:[ 123 size open ] |
|
887 |
ifRaised:[ self halt ] |
|
888 |
" |
|
889 |
! |
|
890 |
||
1 | 891 |
handle:handleBlock do:aBlock |
892 |
"evaluate the argument, aBlock. |
|
893 |
If the receiver-signal is raised during evaluation, |
|
894 |
evaluate the handleBlock passing it an Exception argument. |
|
895 |
The handler may decide how to react to the signal by sending |
|
896 |
a corresponding message to the exception (see there). |
|
897 |
If the signal is not raised, return the value of evaluating |
|
898 |
aBlock." |
|
899 |
||
4547
082a2f7d9d8e
Add #handlerProtectedBlock:inContext
Stefan Vogel <sv@exept.de>
parents:
4540
diff
changeset
|
900 |
<context: #return> |
4491
5041cae5651c
use new pragma to flag exception frames.
Claus Gittinger <cg@exept.de>
parents:
4486
diff
changeset
|
901 |
<exception: #handle> |
95 | 902 |
|
4491
5041cae5651c
use new pragma to flag exception frames.
Claus Gittinger <cg@exept.de>
parents:
4486
diff
changeset
|
903 |
"/ thisContext markForHandle. -- same as above pragma |
5041cae5651c
use new pragma to flag exception frames.
Claus Gittinger <cg@exept.de>
parents:
4486
diff
changeset
|
904 |
^ aBlock value "the real logic is in Exception>>doRaise" |
120 | 905 |
|
4491
5041cae5651c
use new pragma to flag exception frames.
Claus Gittinger <cg@exept.de>
parents:
4486
diff
changeset
|
906 |
" |
5041cae5651c
use new pragma to flag exception frames.
Claus Gittinger <cg@exept.de>
parents:
4486
diff
changeset
|
907 |
Object messageNotUnderstoodSignal handle:[:ex | |
5041cae5651c
use new pragma to flag exception frames.
Claus Gittinger <cg@exept.de>
parents:
4486
diff
changeset
|
908 |
'oops' printNL. |
5041cae5651c
use new pragma to flag exception frames.
Claus Gittinger <cg@exept.de>
parents:
4486
diff
changeset
|
909 |
ex return |
5041cae5651c
use new pragma to flag exception frames.
Claus Gittinger <cg@exept.de>
parents:
4486
diff
changeset
|
910 |
] do:[ |
5041cae5651c
use new pragma to flag exception frames.
Claus Gittinger <cg@exept.de>
parents:
4486
diff
changeset
|
911 |
123 size open |
5041cae5651c
use new pragma to flag exception frames.
Claus Gittinger <cg@exept.de>
parents:
4486
diff
changeset
|
912 |
] |
5041cae5651c
use new pragma to flag exception frames.
Claus Gittinger <cg@exept.de>
parents:
4486
diff
changeset
|
913 |
" |
95 | 914 |
|
4491
5041cae5651c
use new pragma to flag exception frames.
Claus Gittinger <cg@exept.de>
parents:
4486
diff
changeset
|
915 |
" |
5041cae5651c
use new pragma to flag exception frames.
Claus Gittinger <cg@exept.de>
parents:
4486
diff
changeset
|
916 |
|num| |
5041cae5651c
use new pragma to flag exception frames.
Claus Gittinger <cg@exept.de>
parents:
4486
diff
changeset
|
917 |
|
5041cae5651c
use new pragma to flag exception frames.
Claus Gittinger <cg@exept.de>
parents:
4486
diff
changeset
|
918 |
num := 0. |
5041cae5651c
use new pragma to flag exception frames.
Claus Gittinger <cg@exept.de>
parents:
4486
diff
changeset
|
919 |
Number divisionByZeroSignal handle:[:ex | |
5041cae5651c
use new pragma to flag exception frames.
Claus Gittinger <cg@exept.de>
parents:
4486
diff
changeset
|
920 |
'oops' printNL. |
5041cae5651c
use new pragma to flag exception frames.
Claus Gittinger <cg@exept.de>
parents:
4486
diff
changeset
|
921 |
ex return |
5041cae5651c
use new pragma to flag exception frames.
Claus Gittinger <cg@exept.de>
parents:
4486
diff
changeset
|
922 |
] do:[ |
5041cae5651c
use new pragma to flag exception frames.
Claus Gittinger <cg@exept.de>
parents:
4486
diff
changeset
|
923 |
123 / num |
5041cae5651c
use new pragma to flag exception frames.
Claus Gittinger <cg@exept.de>
parents:
4486
diff
changeset
|
924 |
] |
5041cae5651c
use new pragma to flag exception frames.
Claus Gittinger <cg@exept.de>
parents:
4486
diff
changeset
|
925 |
" |
4438 | 926 |
|
4464
cec93c942c14
Use context flag for exception handling instead of searching for
Stefan Vogel <sv@exept.de>
parents:
4440
diff
changeset
|
927 |
"Modified: / 25.7.1999 / 19:43:01 / stefan" |
44 | 928 |
! |
929 |
||
362 | 930 |
handle:handleBlock from:anObject do:aBlock |
931 |
"evaluate the argument, aBlock. |
|
932 |
If the receiver-signal is raised during evaluation, |
|
933 |
and the exception originated from anObject, |
|
934 |
evaluate the handleBlock passing it an Exception argument. |
|
935 |
The handler may decide how to react to the signal by sending |
|
936 |
a corresponding message to the exception (see there). |
|
937 |
If the signal is not raised, return the value of evaluating |
|
938 |
aBlock." |
|
939 |
||
4547
082a2f7d9d8e
Add #handlerProtectedBlock:inContext
Stefan Vogel <sv@exept.de>
parents:
4540
diff
changeset
|
940 |
<context: #return> |
4491
5041cae5651c
use new pragma to flag exception frames.
Claus Gittinger <cg@exept.de>
parents:
4486
diff
changeset
|
941 |
<exception: #handle> |
5041cae5651c
use new pragma to flag exception frames.
Claus Gittinger <cg@exept.de>
parents:
4486
diff
changeset
|
942 |
|
5041cae5651c
use new pragma to flag exception frames.
Claus Gittinger <cg@exept.de>
parents:
4486
diff
changeset
|
943 |
"/ thisContext markForHandle. -- same as above pragma |
5041cae5651c
use new pragma to flag exception frames.
Claus Gittinger <cg@exept.de>
parents:
4486
diff
changeset
|
944 |
^ aBlock value "the real logic is in Exception>>doRaise" |
362 | 945 |
|
4491
5041cae5651c
use new pragma to flag exception frames.
Claus Gittinger <cg@exept.de>
parents:
4486
diff
changeset
|
946 |
" |
5041cae5651c
use new pragma to flag exception frames.
Claus Gittinger <cg@exept.de>
parents:
4486
diff
changeset
|
947 |
the first open will be caught; the second not: |
362 | 948 |
|
4491
5041cae5651c
use new pragma to flag exception frames.
Claus Gittinger <cg@exept.de>
parents:
4486
diff
changeset
|
949 |
|o1 o2| |
362 | 950 |
|
4491
5041cae5651c
use new pragma to flag exception frames.
Claus Gittinger <cg@exept.de>
parents:
4486
diff
changeset
|
951 |
o1 := 123. |
5041cae5651c
use new pragma to flag exception frames.
Claus Gittinger <cg@exept.de>
parents:
4486
diff
changeset
|
952 |
o2 := nil. |
5041cae5651c
use new pragma to flag exception frames.
Claus Gittinger <cg@exept.de>
parents:
4486
diff
changeset
|
953 |
Object messageNotUnderstoodSignal |
5041cae5651c
use new pragma to flag exception frames.
Claus Gittinger <cg@exept.de>
parents:
4486
diff
changeset
|
954 |
handle: |
5041cae5651c
use new pragma to flag exception frames.
Claus Gittinger <cg@exept.de>
parents:
4486
diff
changeset
|
955 |
[:ex | |
5041cae5651c
use new pragma to flag exception frames.
Claus Gittinger <cg@exept.de>
parents:
4486
diff
changeset
|
956 |
'oops' printNL. |
5041cae5651c
use new pragma to flag exception frames.
Claus Gittinger <cg@exept.de>
parents:
4486
diff
changeset
|
957 |
ex proceed |
5041cae5651c
use new pragma to flag exception frames.
Claus Gittinger <cg@exept.de>
parents:
4486
diff
changeset
|
958 |
] |
5041cae5651c
use new pragma to flag exception frames.
Claus Gittinger <cg@exept.de>
parents:
4486
diff
changeset
|
959 |
from:o1 |
5041cae5651c
use new pragma to flag exception frames.
Claus Gittinger <cg@exept.de>
parents:
4486
diff
changeset
|
960 |
do: |
5041cae5651c
use new pragma to flag exception frames.
Claus Gittinger <cg@exept.de>
parents:
4486
diff
changeset
|
961 |
[ |
5041cae5651c
use new pragma to flag exception frames.
Claus Gittinger <cg@exept.de>
parents:
4486
diff
changeset
|
962 |
o1 open. |
5041cae5651c
use new pragma to flag exception frames.
Claus Gittinger <cg@exept.de>
parents:
4486
diff
changeset
|
963 |
o2 open |
5041cae5651c
use new pragma to flag exception frames.
Claus Gittinger <cg@exept.de>
parents:
4486
diff
changeset
|
964 |
] |
5041cae5651c
use new pragma to flag exception frames.
Claus Gittinger <cg@exept.de>
parents:
4486
diff
changeset
|
965 |
" |
4438 | 966 |
|
4464
cec93c942c14
Use context flag for exception handling instead of searching for
Stefan Vogel <sv@exept.de>
parents:
4440
diff
changeset
|
967 |
"Modified: / 25.7.1999 / 19:43:40 / stefan" |
362 | 968 |
! |
969 |
||
419 | 970 |
ignoreIn:aBlock |
6396
74d5b0b588a6
added deferAfter: - defer exceptions until some later time
Claus Gittinger <cg@exept.de>
parents:
6200
diff
changeset
|
971 |
"evaluate the argument, aBlock. |
74d5b0b588a6
added deferAfter: - defer exceptions until some later time
Claus Gittinger <cg@exept.de>
parents:
6200
diff
changeset
|
972 |
Ignore the receiver-signal during evaluation - i.e. simply continue. |
74d5b0b588a6
added deferAfter: - defer exceptions until some later time
Claus Gittinger <cg@exept.de>
parents:
6200
diff
changeset
|
973 |
This makes only sense for some signals, such as UserInterrupt |
74d5b0b588a6
added deferAfter: - defer exceptions until some later time
Claus Gittinger <cg@exept.de>
parents:
6200
diff
changeset
|
974 |
or AbortSignal, because continuing after an exception without any cleanup |
74d5b0b588a6
added deferAfter: - defer exceptions until some later time
Claus Gittinger <cg@exept.de>
parents:
6200
diff
changeset
|
975 |
often leads to followup-errors." |
159 | 976 |
|
6396
74d5b0b588a6
added deferAfter: - defer exceptions until some later time
Claus Gittinger <cg@exept.de>
parents:
6200
diff
changeset
|
977 |
^ self handle:[:ex | ex proceedWith:nil] do:aBlock. |
159 | 978 |
|
6396
74d5b0b588a6
added deferAfter: - defer exceptions until some later time
Claus Gittinger <cg@exept.de>
parents:
6200
diff
changeset
|
979 |
" |
74d5b0b588a6
added deferAfter: - defer exceptions until some later time
Claus Gittinger <cg@exept.de>
parents:
6200
diff
changeset
|
980 |
Object messageNotUnderstoodSignal ignoreIn:[ |
74d5b0b588a6
added deferAfter: - defer exceptions until some later time
Claus Gittinger <cg@exept.de>
parents:
6200
diff
changeset
|
981 |
123 size open |
74d5b0b588a6
added deferAfter: - defer exceptions until some later time
Claus Gittinger <cg@exept.de>
parents:
6200
diff
changeset
|
982 |
] |
74d5b0b588a6
added deferAfter: - defer exceptions until some later time
Claus Gittinger <cg@exept.de>
parents:
6200
diff
changeset
|
983 |
" |
1 | 984 |
! ! |
985 |
||
2207 | 986 |
!Signal class methodsFor:'documentation'! |
1249 | 987 |
|
988 |
version |
|
15375 | 989 |
^ '$Header: /cvs/stx/stx/libbasic/Signal.st,v 1.113 2013-06-05 11:25:09 cg Exp $' |
12062 | 990 |
! |
991 |
||
992 |
version_CVS |
|
15375 | 993 |
^ '$Header: /cvs/stx/stx/libbasic/Signal.st,v 1.113 2013-06-05 11:25:09 cg Exp $' |
1249 | 994 |
! ! |
14961 | 995 |