author | Claus Gittinger <cg@exept.de> |
Tue, 20 Jun 2017 13:36:16 +0200 | |
changeset 21856 | 8a95e50f7005 |
parent 21663 | 1b566be1fc3f |
child 22067 | c685c1804bed |
permissions | -rw-r--r-- |
4481
f3f7e1af7489
added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1 |
" |
f3f7e1af7489
added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2 |
COPYRIGHT (c) 1993 by Claus Gittinger |
16555 | 3 |
All Rights Reserved |
4481
f3f7e1af7489
added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4 |
|
f3f7e1af7489
added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5 |
This software is furnished under a license and may be used |
f3f7e1af7489
added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6 |
only in accordance with the terms of that license and with the |
f3f7e1af7489
added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7 |
inclusion of the above copyright notice. This software may not |
f3f7e1af7489
added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
8 |
be provided or otherwise made available to, or used by, any |
f3f7e1af7489
added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
9 |
other person. No title to or ownership of the software is |
f3f7e1af7489
added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
10 |
hereby transferred. |
f3f7e1af7489
added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
11 |
" |
5348
8220f8db1cc1
added #signalWith: for ANSI compatibility.
Claus Gittinger <cg@exept.de>
parents:
5295
diff
changeset
|
12 |
"{ Package: 'stx:libbasic' }" |
8220f8db1cc1
added #signalWith: for ANSI compatibility.
Claus Gittinger <cg@exept.de>
parents:
5295
diff
changeset
|
13 |
|
17270 | 14 |
"{ NameSpace: Smalltalk }" |
15 |
||
4481
f3f7e1af7489
added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
16 |
Object subclass:#GenericException |
9992
0774694cf9b3
- Add raiseContext as instance variable for faster #resume
Stefan Vogel <sv@exept.de>
parents:
9505
diff
changeset
|
17 |
instanceVariableNames:'signal parameter messageText suspendedContext raiseContext |
0774694cf9b3
- Add raiseContext as instance variable for faster #resume
Stefan Vogel <sv@exept.de>
parents:
9505
diff
changeset
|
18 |
handlerContext rejected originator proceedable' |
8677 | 19 |
classVariableNames:'StrictRaising' |
20 |
poolDictionaries:'' |
|
21 |
category:'Kernel-Exceptions' |
|
4481
f3f7e1af7489
added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
22 |
! |
f3f7e1af7489
added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
23 |
|
f3f7e1af7489
added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
24 |
GenericException class instanceVariableNames:'NotifierString' |
f3f7e1af7489
added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
25 |
|
f3f7e1af7489
added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
26 |
" |
5259 | 27 |
No other class instance variables are inherited by this class. |
4481
f3f7e1af7489
added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
28 |
" |
f3f7e1af7489
added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
29 |
! |
f3f7e1af7489
added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
30 |
|
f3f7e1af7489
added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
31 |
!GenericException class methodsFor:'documentation'! |
f3f7e1af7489
added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
32 |
|
f3f7e1af7489
added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
33 |
copyright |
f3f7e1af7489
added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
34 |
" |
f3f7e1af7489
added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
35 |
COPYRIGHT (c) 1993 by Claus Gittinger |
16555 | 36 |
All Rights Reserved |
4481
f3f7e1af7489
added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
37 |
|
f3f7e1af7489
added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
38 |
This software is furnished under a license and may be used |
f3f7e1af7489
added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
39 |
only in accordance with the terms of that license and with the |
f3f7e1af7489
added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
40 |
inclusion of the above copyright notice. This software may not |
f3f7e1af7489
added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
41 |
be provided or otherwise made available to, or used by, any |
f3f7e1af7489
added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
42 |
other person. No title to or ownership of the software is |
f3f7e1af7489
added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
43 |
hereby transferred. |
f3f7e1af7489
added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
44 |
" |
f3f7e1af7489
added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
45 |
! |
f3f7e1af7489
added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
46 |
|
f3f7e1af7489
added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
47 |
documentation |
f3f7e1af7489
added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
48 |
" |
8617 | 49 |
Note: |
19717 | 50 |
The instance based Signal framework is being replaced by |
51 |
class based exceptions. |
|
52 |
I.e. what used to be instances of Signal/QuerySignal is being |
|
53 |
rewritten into subclasses of Exception/Error/Query and Warning. |
|
54 |
Although the functionality is basically unchanged, the new |
|
20089 | 55 |
class based exceptions are easier to instantiate (no need for |
19717 | 56 |
creation in a classes initialize method), easier to use (no real |
20095 | 57 |
need for Signal-constant accessors) and allow for easier parameter |
19717 | 58 |
passing (not only a single parameter, but allows for individual |
59 |
exception subclasses to add additional state). |
|
6430
9a1580465dd2
better impl. of #deferAfter:
Claus Gittinger <cg@exept.de>
parents:
6426
diff
changeset
|
60 |
|
4481
f3f7e1af7489
added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
61 |
GenericException and its subclasses implement the same protocol as Signal. |
f3f7e1af7489
added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
62 |
So class based exceptions may be implemented as subclasses of GenericException. |
f3f7e1af7489
added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
63 |
|
7631
df27883aa7db
Undo previous change form cg (on his request!).
Stefan Vogel <sv@exept.de>
parents:
7597
diff
changeset
|
64 |
Normally all exceptions are subclasses of Exception. Exceptions, that are |
df27883aa7db
Undo previous change form cg (on his request!).
Stefan Vogel <sv@exept.de>
parents:
7597
diff
changeset
|
65 |
used for debugging or that are signalling errors in the exception system itself |
df27883aa7db
Undo previous change form cg (on his request!).
Stefan Vogel <sv@exept.de>
parents:
7597
diff
changeset
|
66 |
are direct subclasses of GenericException. |
df27883aa7db
Undo previous change form cg (on his request!).
Stefan Vogel <sv@exept.de>
parents:
7597
diff
changeset
|
67 |
|
4481
f3f7e1af7489
added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
68 |
Instances of Exception are passed to a Signal handling block as argument. |
f3f7e1af7489
added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
69 |
The handler block may perform various actions by sending corresponding messages |
f3f7e1af7489
added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
70 |
to the exception object. The following actions are possible: |
f3f7e1af7489
added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
71 |
|
19717 | 72 |
reject - don't handle this signal; |
73 |
another handler will be searched for, |
|
74 |
upper in the calling hierarchy |
|
75 |
||
76 |
proceed - return from the Signal>>raise, with nil as value |
|
77 |
||
78 |
proceedWith:val - same, but return val from Signal>>raise |
|
79 |
||
80 |
return - return from the Signal>>handle:do:, with nil as value |
|
81 |
||
82 |
returnWith:val - same, but return val from Signal>>handle:do: |
|
83 |
(this is also the handler's default, |
|
84 |
if it falls through; taking the handlerBlocks value |
|
85 |
as return value) |
|
86 |
||
87 |
restart - restart the Signal>>handle:do:, after repairing |
|
4481
f3f7e1af7489
added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
88 |
|
f3f7e1af7489
added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
89 |
Via the Exception object, the handler can also query the state of execution: |
f3f7e1af7489
added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
90 |
where the Signal was raised, where the handler is, the signal which caused |
8313
2aa626e8e404
Fix do not execute an exception handler inside the do-block, when the
Stefan Vogel <sv@exept.de>
parents:
8254
diff
changeset
|
91 |
the error and the messageText passed when the signal was raised. Also, an optional |
4481
f3f7e1af7489
added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
92 |
parameter can be passed - the use is signal specific. |
f3f7e1af7489
added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
93 |
|
f3f7e1af7489
added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
94 |
[instance variables:] |
19717 | 95 |
signal <Signal> the signal which caused the exception |
96 |
||
97 |
parameter <Object> a parameter (if any) which was passed when raising |
|
98 |
the signal (only if raised with #raiseWith:aParameter) |
|
99 |
||
100 |
messageText <String> an messageText |
|
101 |
(usually the signals own messageText, but sometimes |
|
102 |
changed explicitely in #raiseWith:errorString:) |
|
103 |
||
20261 | 104 |
suspendedContext <Context> the context in which the raise occurred |
19717 | 105 |
|
106 |
handlerContext <Context> the context of the handler (if any) |
|
8617 | 107 |
|
108 |
In case of an unhandled signal raise, Exceptions EmergenyHandler will be evaluated. |
|
4481
f3f7e1af7489
added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
109 |
The default emergeny handler will enter the debugger. |
f3f7e1af7489
added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
110 |
|
f3f7e1af7489
added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
111 |
For applications, which do not want Debuggers to come up, other handlers are |
f3f7e1af7489
added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
112 |
possible. |
f3f7e1af7489
added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
113 |
For example, to get the typical C++ behavior, use: |
19717 | 114 |
Exception emergencyHandler:[:ex | Smalltalk exitWithCoreDump] |
4481
f3f7e1af7489
added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
115 |
|
6430
9a1580465dd2
better impl. of #deferAfter:
Claus Gittinger <cg@exept.de>
parents:
6426
diff
changeset
|
116 |
|
9a1580465dd2
better impl. of #deferAfter:
Claus Gittinger <cg@exept.de>
parents:
6426
diff
changeset
|
117 |
Raising: |
19717 | 118 |
two different raising messages are to be used, |
119 |
depending on whether the exception is proceedable or not |
|
120 |
||
121 |
For some stupid reason, someone decided that the raise-code checks if |
|
122 |
the raising messages matches to what the signal thinks is its proceedability. |
|
123 |
(i.e. not only do both the sender and the signal itself specify proceedability, |
|
124 |
this is checked by the raise code and a warning is generated if there is a mismatch) |
|
125 |
This used to be even worse (WrongProceedabilityError), but we relaxed this to |
|
126 |
a message sent to stderr. |
|
127 |
||
128 |
That means, that PROCEEDABLE signals must be raised with: |
|
129 |
raiseRequest |
|
130 |
and NON-PROCEEDABLE signals must be raised with: |
|
131 |
raise |
|
132 |
||
20800 | 133 |
If you don't know/care as a raiser, you can use |
19717 | 134 |
raiseSignal |
135 |
which checks for proceedability and sends the appropriate message. |
|
136 |
(sigh) |
|
6430
9a1580465dd2
better impl. of #deferAfter:
Claus Gittinger <cg@exept.de>
parents:
6426
diff
changeset
|
137 |
|
9a1580465dd2
better impl. of #deferAfter:
Claus Gittinger <cg@exept.de>
parents:
6426
diff
changeset
|
138 |
all of the 3 messages above come in various flavours: |
19717 | 139 |
raiseXXX - do not pass any additional parameter; |
140 |
default messageText |
|
141 |
||
142 |
raiseXXXWith: - pass additional parameter; |
|
143 |
default messageText |
|
144 |
||
145 |
raiseXXXErrorString: - do not pass any additional parameter; |
|
146 |
given errorString |
|
147 |
||
148 |
raiseXXXWith:errorString: |
|
149 |
- pass any additional parameter; |
|
150 |
AND given errorString |
|
6430
9a1580465dd2
better impl. of #deferAfter:
Claus Gittinger <cg@exept.de>
parents:
6426
diff
changeset
|
151 |
|
9a1580465dd2
better impl. of #deferAfter:
Claus Gittinger <cg@exept.de>
parents:
6426
diff
changeset
|
152 |
|
4481
f3f7e1af7489
added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
153 |
[see also:] |
19717 | 154 |
Signal SignalSet QuerySignal |
155 |
Context Block |
|
156 |
Object DebugView |
|
157 |
(``Exception handling and signals'': programming/exceptions.html) |
|
4481
f3f7e1af7489
added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
158 |
|
f3f7e1af7489
added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
159 |
[author:] |
19717 | 160 |
Claus Gittinger |
4481
f3f7e1af7489
added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
161 |
" |
f3f7e1af7489
added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
162 |
! |
f3f7e1af7489
added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
163 |
|
f3f7e1af7489
added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
164 |
examples |
f3f7e1af7489
added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
165 |
" |
f3f7e1af7489
added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
166 |
Examples on Exception-raising & handling are found in the doc/coding |
f3f7e1af7489
added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
167 |
section (CodingExamples). |
f3f7e1af7489
added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
168 |
|
f3f7e1af7489
added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
169 |
The emergencyHandler stuff is very useful, to prevent endUser applications |
4554 | 170 |
from entering the debugger. See the examples in NoHandlerError. |
4481
f3f7e1af7489
added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
171 |
" |
f3f7e1af7489
added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
172 |
! ! |
f3f7e1af7489
added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
173 |
|
f3f7e1af7489
added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
174 |
!GenericException class methodsFor:'initialization'! |
f3f7e1af7489
added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
175 |
|
8617 | 176 |
initialize |
4519
fb4904d6787b
Implement RecursiveExceptionError. as class based exception.
Stefan Vogel <sv@exept.de>
parents:
4517
diff
changeset
|
177 |
NotifierString := 'unknown exception'. |
15636 | 178 |
"force strict signal checking in Smalltalk development - nobody cares otherwise" |
179 |
StrictRaising := Smalltalk isStandAloneApp not. "set to true to check whether a signal may be raised proceedable" |
|
4519
fb4904d6787b
Implement RecursiveExceptionError. as class based exception.
Stefan Vogel <sv@exept.de>
parents:
4517
diff
changeset
|
180 |
|
13132 | 181 |
"Modified: / 04-08-1999 / 09:06:26 / stefan" |
182 |
"Modified: / 17-11-2010 / 17:53:13 / cg" |
|
4481
f3f7e1af7489
added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
183 |
! ! |
f3f7e1af7489
added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
184 |
|
f3f7e1af7489
added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
185 |
!GenericException class methodsFor:'instance creation'! |
f3f7e1af7489
added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
186 |
|
8487 | 187 |
new |
188 |
"{ Pragma: +inlineNew }" |
|
189 |
||
16190 | 190 |
^ self basicNew initialize creator:self. |
8487 | 191 |
|
192 |
"Modified: / 23.7.1999 / 13:53:12 / stefan" |
|
193 |
"Created: / 24.7.1999 / 13:21:13 / stefan" |
|
194 |
! |
|
195 |
||
196 |
newException |
|
8684
9c00854305f7
QuerySignal generates Notifications instead of Exceptions.
Stefan Vogel <sv@exept.de>
parents:
8681
diff
changeset
|
197 |
"{ Pragma: +inlineNew }" |
8487 | 198 |
|
16190 | 199 |
^ self basicNew initialize creator:self. |
8487 | 200 |
|
201 |
"Created: / 23.7.1999 / 13:45:49 / stefan" |
|
202 |
"Modified: / 24.7.1999 / 13:21:25 / stefan" |
|
4481
f3f7e1af7489
added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
203 |
! ! |
f3f7e1af7489
added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
204 |
|
14962 | 205 |
|
15123 | 206 |
!GenericException class methodsFor:'Compatibility-ANSI'! |
10189 | 207 |
|
208 |
signal |
|
209 |
"raise a signal proceedable or nonproceedable (whichever is right). |
|
15123 | 210 |
ANSI compatibility." |
10189 | 211 |
|
212 |
^ self raiseSignal |
|
213 |
||
214 |
"Created: / 20-11-2006 / 14:00:09 / cg" |
|
15123 | 215 |
! |
216 |
||
217 |
signalWith:messageText |
|
218 |
"raise a signal proceedable or nonproceedable (whichever is right). |
|
219 |
The argument is used as messageText. |
|
220 |
ANSI compatibility." |
|
221 |
||
222 |
<resource: #skipInDebuggersWalkBack> |
|
223 |
||
224 |
self raiseErrorString:messageText |
|
10189 | 225 |
! ! |
226 |
||
21038 | 227 |
|
4562 | 228 |
!GenericException class methodsFor:'accessing'! |
229 |
||
4481
f3f7e1af7489
added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
230 |
errorString |
4562 | 231 |
"#errorString is deprecated, use description instead" |
4481
f3f7e1af7489
added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
232 |
|
6859
5ef85865e8db
Print exception description with #printOn:
Stefan Vogel <sv@exept.de>
parents:
6630
diff
changeset
|
233 |
<resource:#obsolete> |
5ef85865e8db
Print exception description with #printOn:
Stefan Vogel <sv@exept.de>
parents:
6630
diff
changeset
|
234 |
|
4562 | 235 |
^ self description |
4481
f3f7e1af7489
added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
236 |
! |
f3f7e1af7489
added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
237 |
|
f3f7e1af7489
added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
238 |
handlerBlock |
19626 | 239 |
"Compatibility with Signal. Class based exceptions do not have a handler |
4481
f3f7e1af7489
added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
240 |
block. They redefine the #action method instead" |
f3f7e1af7489
added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
241 |
|
f3f7e1af7489
added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
242 |
^ nil |
f3f7e1af7489
added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
243 |
|
f3f7e1af7489
added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
244 |
"Created: / 23.7.1999 / 14:43:18 / stefan" |
f3f7e1af7489
added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
245 |
"Modified: / 24.7.1999 / 20:52:10 / stefan" |
8677 | 246 |
! |
247 |
||
248 |
notifierString:aString |
|
249 |
||
250 |
NotifierString := aString |
|
4481
f3f7e1af7489
added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
251 |
! ! |
f3f7e1af7489
added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
252 |
|
8677 | 253 |
!GenericException class methodsFor:'backward compatibility'! |
254 |
||
255 |
abortingEmergencyHandler |
|
256 |
"WARNING: this method belongs to NoHandlerError, and has been moved there" |
|
257 |
<resource: #obsolete> |
|
258 |
||
259 |
^ NoHandlerError abortingEmergencyHandler |
|
260 |
! |
|
261 |
||
262 |
dumpingEmergencyHandler |
|
263 |
"WARNING: this method belongs to NoHandlerError, and has been moved there" |
|
264 |
<resource: #obsolete> |
|
265 |
||
266 |
^ NoHandlerError dumpingEmergencyHandler |
|
267 |
! |
|
4562 | 268 |
|
269 |
emergencyHandler |
|
8677 | 270 |
"WARNING: this method belongs to NoHandlerError, and has been moved there" |
271 |
<resource: #obsolete> |
|
4562 | 272 |
|
273 |
^ NoHandlerError emergencyHandler. |
|
274 |
! |
|
275 |
||
276 |
emergencyHandler:aOneArgBlock |
|
8677 | 277 |
"WARNING: this method belongs to NoHandlerError, and has been moved there" |
278 |
<resource: #obsolete> |
|
279 |
||
280 |
^ NoHandlerError emergencyHandler:aOneArgBlock |
|
281 |
! |
|
282 |
||
283 |
mailingEmergencyHandler |
|
284 |
"WARNING: this method belongs to NoHandlerError, and has been moved there" |
|
285 |
<resource: #obsolete> |
|
286 |
||
287 |
^ NoHandlerError mailingEmergencyHandler |
|
288 |
! |
|
289 |
||
290 |
notifyingEmergencyHandler |
|
291 |
"WARNING: this method belongs to NoHandlerError, and has been moved there" |
|
292 |
<resource: #obsolete> |
|
293 |
||
294 |
^ NoHandlerError notifyingEmergencyHandler |
|
295 |
! |
|
4562 | 296 |
|
8677 | 297 |
notifyingEmergencyHandlerForUserProcesses |
298 |
"WARNING: this method belongs to NoHandlerError, and has been moved there" |
|
299 |
<resource: #obsolete> |
|
300 |
||
301 |
^ NoHandlerError notifyingEmergencyHandlerForUserProcesses |
|
302 |
! ! |
|
303 |
||
304 |
!GenericException class methodsFor:'child signal creation'! |
|
4562 | 305 |
|
8677 | 306 |
newSignal |
307 |
"create a new signal, using the receiver as a prototype and |
|
308 |
setting the parent of the new signal to the receiver." |
|
309 |
||
310 |
^ self newSignalMayProceed:self mayProceed |
|
311 |
||
312 |
"Created: / 23.7.1999 / 20:13:23 / stefan" |
|
313 |
! |
|
314 |
||
315 |
newSignalMayProceed:mayProceedBoolean |
|
316 |
"create a new signal, using the receiver as a prototype and |
|
317 |
setting the parent of the new signal to the receiver." |
|
318 |
||
319 |
|sig| |
|
4562 | 320 |
|
8677 | 321 |
self isQuerySignal ifTrue:[ |
16555 | 322 |
sig := QuerySignal basicNew. |
323 |
mayProceedBoolean ifFalse:[ |
|
324 |
'Exception [warning]: nonProceedable queries do not make sense' infoPrintCR. |
|
325 |
]. |
|
8677 | 326 |
] ifFalse:[ |
16555 | 327 |
sig := Signal basicNew. |
8677 | 328 |
]. |
329 |
^ sig |
|
16555 | 330 |
mayProceed:mayProceedBoolean; |
331 |
notifierString:NotifierString; |
|
332 |
parent:self |
|
8677 | 333 |
|
334 |
"Created: / 23.7.1999 / 20:12:43 / stefan" |
|
335 |
! ! |
|
336 |
||
337 |
!GenericException class methodsFor:'converting'! |
|
338 |
||
339 |
, anExceptionHandler |
|
340 |
"return a SignalSet with myself and anExceptionHandler" |
|
4562 | 341 |
|
8677 | 342 |
^ SignalSet with:self with:anExceptionHandler |
343 |
! ! |
|
344 |
||
12085 | 345 |
|
8677 | 346 |
!GenericException class methodsFor:'printing'! |
347 |
||
348 |
description |
|
349 |
"return the notifier string. |
|
350 |
If the notifier string starts with space, prepend |
|
351 |
the parents notifier string. |
|
352 |
Subclasses may redefine this method." |
|
353 |
||
354 |
|parent| |
|
4562 | 355 |
|
8677 | 356 |
NotifierString isNil ifTrue:[ |
16555 | 357 |
^ self nameForDescription asString |
8677 | 358 |
]. |
359 |
(NotifierString startsWith:Character space) ifTrue:[ |
|
16555 | 360 |
(parent := self parent) notNil ifTrue:[ |
361 |
^ parent description, NotifierString |
|
362 |
]. |
|
8677 | 363 |
]. |
364 |
^ NotifierString |
|
365 |
||
366 |
" |
|
367 |
Object errorSignal description |
|
4562 | 368 |
" |
369 |
||
13305 | 370 |
"Created: / 23-07-1999 / 14:22:25 / stefan" |
371 |
"Modified: / 10-02-2011 / 12:29:07 / cg" |
|
372 |
! |
|
373 |
||
374 |
nameForDescription |
|
375 |
"if no notifierString is specified, this is used. |
|
376 |
Can be redfined to hide the namespace in subclasses" |
|
377 |
||
378 |
^ self name |
|
379 |
||
380 |
"Created: / 10-02-2011 / 12:28:51 / cg" |
|
4562 | 381 |
! ! |
382 |
||
8677 | 383 |
!GenericException class methodsFor:'queries'! |
4481
f3f7e1af7489
added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
384 |
|
f3f7e1af7489
added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
385 |
accepts:aSignal |
f3f7e1af7489
added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
386 |
"return true, if the receiver accepts the argument, aSignal. |
f3f7e1af7489
added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
387 |
(i.e. the receiver is aSignal or a parent of it). False otherwise." |
f3f7e1af7489
added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
388 |
|
f3f7e1af7489
added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
389 |
|s| |
f3f7e1af7489
added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
390 |
|
4527 | 391 |
self == aSignal ifTrue:[^ true]. |
4481
f3f7e1af7489
added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
392 |
aSignal isQuerySignal ifTrue:[^ false]. |
f3f7e1af7489
added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
393 |
|
8681
38aa963476a5
Support for Block>>#on:do:on:do:
Stefan Vogel <sv@exept.de>
parents:
8677
diff
changeset
|
394 |
s := aSignal parent. |
4481
f3f7e1af7489
added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
395 |
[s notNil] whileTrue:[ |
16555 | 396 |
self == s ifTrue:[^ true]. |
397 |
s := s parent |
|
4481
f3f7e1af7489
added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
398 |
]. |
f3f7e1af7489
added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
399 |
^ false |
f3f7e1af7489
added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
400 |
|
f3f7e1af7489
added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
401 |
"Created: / 23.7.1999 / 14:00:47 / stefan" |
f3f7e1af7489
added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
402 |
! |
f3f7e1af7489
added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
403 |
|
9505 | 404 |
exception:anException isHandledIn:aContext |
405 |
"return true, if there is a handler for anException in the |
|
4676 | 406 |
contextChain starting with aContext." |
407 |
||
9505 | 408 |
^ (self handlerContextForException:anException in:aContext) notNil |
409 |
! |
|
410 |
||
411 |
exceptionHandlerFor:anException in:aContext |
|
412 |
"answer the exceptionHandler-block for anException from aContext." |
|
413 |
||
414 |
|sel| |
|
415 |
||
416 |
sel := aContext selector. |
|
417 |
(sel == #'handle:from:do:' |
|
418 |
or:[sel == #'handle:do:']) ifTrue:[ |
|
16555 | 419 |
^ aContext receiver |
9505 | 420 |
]. |
421 |
||
422 |
^ nil |
|
423 |
! |
|
424 |
||
425 |
handlerContextForException:anException in:aContext |
|
426 |
"return a handlerContext for anException in the |
|
16555 | 427 |
contextChain starting with aContext. |
14085
aea63f5d809c
changed comment: #handlerContextForException:in:
Stefan Vogel <sv@exept.de>
parents:
13803
diff
changeset
|
428 |
Returns nil, if there is no handler." |
9505 | 429 |
|
430 |
|theContext ex1 con1| |
|
8313
2aa626e8e404
Fix do not execute an exception handler inside the do-block, when the
Stefan Vogel <sv@exept.de>
parents:
8254
diff
changeset
|
431 |
|
2aa626e8e404
Fix do not execute an exception handler inside the do-block, when the
Stefan Vogel <sv@exept.de>
parents:
8254
diff
changeset
|
432 |
theContext := aContext findExceptional. |
2aa626e8e404
Fix do not execute an exception handler inside the do-block, when the
Stefan Vogel <sv@exept.de>
parents:
8254
diff
changeset
|
433 |
[theContext notNil] whileTrue:[ |
16555 | 434 |
theContext isRaiseContext ifTrue:[ |
435 |
"skip all the contexts between the raise and the sender of #handle:do" |
|
436 |
ex1 := theContext receiver. "exception, that has been raised" |
|
437 |
con1 := ex1 handlerContext. "the context of the #handle:do:" |
|
438 |
con1 notNil ifTrue:[ |
|
439 |
"handlerContext may be nil, if this is a default action" |
|
440 |
theContext := con1. |
|
441 |
]. |
|
442 |
ex1 := con1 := nil. |
|
443 |
] ifFalse:[ |r| |
|
444 |
((r := theContext receiver) notNil |
|
445 |
and:[(r handlerForSignal:anException context:theContext originator:nil) notNil] |
|
446 |
) ifTrue:[ |
|
447 |
"found a handler context" |
|
448 |
^ theContext |
|
449 |
]. |
|
450 |
]. |
|
451 |
theContext notNil ifTrue:[ |
|
452 |
theContext := theContext findSpecialHandle:true raise:true. |
|
453 |
]. |
|
4676 | 454 |
]. |
8313
2aa626e8e404
Fix do not execute an exception handler inside the do-block, when the
Stefan Vogel <sv@exept.de>
parents:
8254
diff
changeset
|
455 |
|
8681
38aa963476a5
Support for Block>>#on:do:on:do:
Stefan Vogel <sv@exept.de>
parents:
8677
diff
changeset
|
456 |
^ nil |
38aa963476a5
Support for Block>>#on:do:on:do:
Stefan Vogel <sv@exept.de>
parents:
8677
diff
changeset
|
457 |
! |
38aa963476a5
Support for Block>>#on:do:on:do:
Stefan Vogel <sv@exept.de>
parents:
8677
diff
changeset
|
458 |
|
4481
f3f7e1af7489
added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
459 |
handlerForSignal:signal context:theContext originator:originator |
f3f7e1af7489
added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
460 |
"answer the handler block for the signal from originator. |
f3f7e1af7489
added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
461 |
The block is retrieved from aContext. |
f3f7e1af7489
added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
462 |
Answer nil if the signal is not handled" |
f3f7e1af7489
added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
463 |
|
f3f7e1af7489
added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
464 |
(theContext selector ~~ #'handle:from:do:' |
f3f7e1af7489
added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
465 |
or:[(theContext argAt:2) == originator]) ifTrue:[ |
16555 | 466 |
(self == signal or:[self accepts:signal]) ifTrue:[ |
467 |
^ (theContext argAt:1) ? [nil] |
|
468 |
] |
|
4481
f3f7e1af7489
added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
469 |
]. |
f3f7e1af7489
added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
470 |
|
f3f7e1af7489
added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
471 |
^ nil |
f3f7e1af7489
added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
472 |
|
f3f7e1af7489
added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
473 |
"Created: / 25.7.1999 / 19:52:58 / stefan" |
f3f7e1af7489
added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
474 |
! |
f3f7e1af7489
added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
475 |
|
4544
2a0e3853d320
#returnDoing works for any exception handler.
Stefan Vogel <sv@exept.de>
parents:
4538
diff
changeset
|
476 |
handlerProtectedBlock:doBlock inContext:context |
2a0e3853d320
#returnDoing works for any exception handler.
Stefan Vogel <sv@exept.de>
parents:
4538
diff
changeset
|
477 |
"set the handlerProtectedBlock in context" |
2a0e3853d320
#returnDoing works for any exception handler.
Stefan Vogel <sv@exept.de>
parents:
4538
diff
changeset
|
478 |
|
5590 | 479 |
|sel| |
480 |
||
481 |
sel := context selector. |
|
482 |
sel == #handle:do: ifTrue:[ |
|
16555 | 483 |
context argAt:2 put:doBlock. |
5590 | 484 |
] ifFalse:[sel == #handle:from:do: ifTrue:[ |
16555 | 485 |
context argAt:3 put:doBlock. |
4544
2a0e3853d320
#returnDoing works for any exception handler.
Stefan Vogel <sv@exept.de>
parents:
4538
diff
changeset
|
486 |
]]. |
2a0e3853d320
#returnDoing works for any exception handler.
Stefan Vogel <sv@exept.de>
parents:
4538
diff
changeset
|
487 |
! |
2a0e3853d320
#returnDoing works for any exception handler.
Stefan Vogel <sv@exept.de>
parents:
4538
diff
changeset
|
488 |
|
8681
38aa963476a5
Support for Block>>#on:do:on:do:
Stefan Vogel <sv@exept.de>
parents:
8677
diff
changeset
|
489 |
handles:anException |
38aa963476a5
Support for Block>>#on:do:on:do:
Stefan Vogel <sv@exept.de>
parents:
8677
diff
changeset
|
490 |
"return true, if the receiver handles the argument, anException. |
38aa963476a5
Support for Block>>#on:do:on:do:
Stefan Vogel <sv@exept.de>
parents:
8677
diff
changeset
|
491 |
(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:
8677
diff
changeset
|
492 |
|
38aa963476a5
Support for Block>>#on:do:on:do:
Stefan Vogel <sv@exept.de>
parents:
8677
diff
changeset
|
493 |
|signal| |
38aa963476a5
Support for Block>>#on:do:on:do:
Stefan Vogel <sv@exept.de>
parents:
8677
diff
changeset
|
494 |
|
15123 | 495 |
signal := anException creator. |
8681
38aa963476a5
Support for Block>>#on:do:on:do:
Stefan Vogel <sv@exept.de>
parents:
8677
diff
changeset
|
496 |
|
38aa963476a5
Support for Block>>#on:do:on:do:
Stefan Vogel <sv@exept.de>
parents:
8677
diff
changeset
|
497 |
self == signal ifTrue:[^ true]. "quick check" |
38aa963476a5
Support for Block>>#on:do:on:do:
Stefan Vogel <sv@exept.de>
parents:
8677
diff
changeset
|
498 |
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:
8677
diff
changeset
|
499 |
|
38aa963476a5
Support for Block>>#on:do:on:do:
Stefan Vogel <sv@exept.de>
parents:
8677
diff
changeset
|
500 |
[(signal := signal parent) notNil] whileTrue:[ |
16555 | 501 |
self == signal ifTrue:[^ true]. |
4481
f3f7e1af7489
added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
502 |
]. |
8681
38aa963476a5
Support for Block>>#on:do:on:do:
Stefan Vogel <sv@exept.de>
parents:
8677
diff
changeset
|
503 |
^ false |
4481
f3f7e1af7489
added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
504 |
! |
f3f7e1af7489
added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
505 |
|
f3f7e1af7489
added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
506 |
isHandled |
f3f7e1af7489
added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
507 |
"return true, if there is a handler for the receiver signal. |
f3f7e1af7489
added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
508 |
Raising an unhandled signal will usually lead into the debugger, |
f3f7e1af7489
added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
509 |
but can be caught globally by setting Exceptions EmergencyHandler." |
f3f7e1af7489
added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
510 |
|
4676 | 511 |
^ self exception:self isHandledIn:(thisContext sender). |
4481
f3f7e1af7489
added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
512 |
|
f3f7e1af7489
added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
513 |
"Created: / 23.7.1999 / 14:03:50 / stefan" |
f3f7e1af7489
added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
514 |
! |
f3f7e1af7489
added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
515 |
|
f3f7e1af7489
added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
516 |
isHandledIn:aContext |
8617 | 517 |
"return true, if there is a handler for the receiver signal in the |
4481
f3f7e1af7489
added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
518 |
contextChain starting with aContext." |
f3f7e1af7489
added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
519 |
|
4676 | 520 |
^ self exception:self isHandledIn:aContext |
4481
f3f7e1af7489
added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
521 |
! |
f3f7e1af7489
added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
522 |
|
f3f7e1af7489
added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
523 |
parent |
f3f7e1af7489
added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
524 |
"return the parent Signal/Exception of myself. |
f3f7e1af7489
added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
525 |
Subclasses may redefine this to install themself as child of |
f3f7e1af7489
added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
526 |
existing Signals." |
f3f7e1af7489
added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
527 |
|
f3f7e1af7489
added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
528 |
self == GenericException ifTrue:[ |
16555 | 529 |
^ nil |
4481
f3f7e1af7489
added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
530 |
]. |
f3f7e1af7489
added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
531 |
|
f3f7e1af7489
added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
532 |
^ self superclass |
f3f7e1af7489
added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
533 |
|
f3f7e1af7489
added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
534 |
"Created: / 23.7.1999 / 14:01:29 / stefan" |
f3f7e1af7489
added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
535 |
"Modified: / 23.7.1999 / 16:15:38 / stefan" |
f3f7e1af7489
added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
536 |
! ! |
f3f7e1af7489
added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
537 |
|
8677 | 538 |
!GenericException class methodsFor:'raising'! |
4481
f3f7e1af7489
added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
539 |
|
f3f7e1af7489
added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
540 |
raise |
f3f7e1af7489
added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
541 |
"raise a signal nonproceedable. |
8313
2aa626e8e404
Fix do not execute an exception handler inside the do-block, when the
Stefan Vogel <sv@exept.de>
parents:
8254
diff
changeset
|
542 |
The signals notifierString is used as messageText." |
4481
f3f7e1af7489
added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
543 |
|
4556 | 544 |
<context: #return> |
11026 | 545 |
<resource: #skipInDebuggersWalkBack> |
4556 | 546 |
|
13009
e068f228a24b
eliminated 1 to 2 message sends when raising
Claus Gittinger <cg@exept.de>
parents:
12940
diff
changeset
|
547 |
^ self basicNew |
16555 | 548 |
raiseIn:thisContext sender |
13009
e068f228a24b
eliminated 1 to 2 message sends when raising
Claus Gittinger <cg@exept.de>
parents:
12940
diff
changeset
|
549 |
|
e068f228a24b
eliminated 1 to 2 message sends when raising
Claus Gittinger <cg@exept.de>
parents:
12940
diff
changeset
|
550 |
"Created: / 23-07-1999 / 14:07:17 / stefan" |
e068f228a24b
eliminated 1 to 2 message sends when raising
Claus Gittinger <cg@exept.de>
parents:
12940
diff
changeset
|
551 |
"Modified: / 10-08-2010 / 09:30:42 / cg" |
4481
f3f7e1af7489
added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
552 |
! |
f3f7e1af7489
added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
553 |
|
19776 | 554 |
raiseAsQuery |
555 |
"utility to avoid code duplication. |
|
556 |
raise the exception as a query. This means, that if it is unhandled, |
|
557 |
a default value is returned (i.e. an implicit resume). |
|
558 |
Return the handler's value (if there is one), or the default value, if not. |
|
559 |
Invoking the handler is exactly the functionality of Signal>>raiseRequest, |
|
560 |
but we can do it faster here (avoiding the construction of an exception instance)." |
|
561 |
||
562 |
|con signal ret| |
|
563 |
||
564 |
self isQuerySignal ifFalse:[ self error:'this may only be used by queries' ]. |
|
565 |
||
566 |
con := Context findFirstSpecialHandle:true raise:false. |
|
567 |
[con notNil] whileTrue:[ |
|
20261 | 568 |
(con selector == #answer:do:) ifTrue:[ |
19776 | 569 |
signal := con receiver. |
570 |
signal == self ifTrue:[ |
|
571 |
ret := con argAt:1. |
|
572 |
con := nil. |
|
573 |
^ ret |
|
574 |
]. |
|
575 |
signal isNil ifTrue:[ |
|
576 |
self error:'nil receiver in #answer:do: - send'. |
|
577 |
]. |
|
578 |
(signal accepts:self) ifTrue:[ |
|
579 |
ret := con argAt:1. |
|
580 |
con := nil. |
|
581 |
^ ret |
|
582 |
]. |
|
583 |
] ifFalse:[ |
|
20186 | 584 |
"ask the receiver of the #handle:do: or #on:do: or whatever- message for the handler. |
19776 | 585 |
nil is returned, if the signal is not accepted" |
586 |
|r| |
|
587 |
r := con receiver. "receiver of #handle:do: or #on:do:" |
|
588 |
(r notNil and:[(r handlerForSignal:self |
|
589 |
context:con |
|
590 |
originator:thisContext sender homeReceiver) notNil] |
|
591 |
) ifTrue:[ |
|
592 |
"there is another handler block, maybe it will return the answer. |
|
593 |
Call it via raiseRequest" |
|
594 |
con := nil. |
|
595 |
^ here raiseRequest "/ <- notice the here, to avoid recursion due |
|
596 |
"/ to redefined raiseRequest in Query |
|
597 |
]. |
|
598 |
]. |
|
599 |
con := con findSpecialHandle:true raise:false. |
|
600 |
]. |
|
601 |
||
602 |
"/ no handler found - return the default value |
|
603 |
^ self defaultAnswer |
|
604 |
||
605 |
"Modified: / 15-06-1998 / 21:27:37 / cg" |
|
606 |
"Modified: / 25-07-1999 / 23:15:16 / stefan" |
|
607 |
"Modified: / 11-03-2015 / 11:26:45 / sr" |
|
608 |
! |
|
609 |
||
4481
f3f7e1af7489
added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
610 |
raiseErrorString:aString |
f3f7e1af7489
added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
611 |
"raise a signal nonproceedable. |
8313
2aa626e8e404
Fix do not execute an exception handler inside the do-block, when the
Stefan Vogel <sv@exept.de>
parents:
8254
diff
changeset
|
612 |
The argument is used as messageText." |
4481
f3f7e1af7489
added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
613 |
|
4556 | 614 |
<context: #return> |
11026 | 615 |
<resource: #skipInDebuggersWalkBack> |
4556 | 616 |
|
13009
e068f228a24b
eliminated 1 to 2 message sends when raising
Claus Gittinger <cg@exept.de>
parents:
12940
diff
changeset
|
617 |
^ self basicNew |
16555 | 618 |
raiseErrorString:aString |
619 |
in:thisContext sender |
|
13009
e068f228a24b
eliminated 1 to 2 message sends when raising
Claus Gittinger <cg@exept.de>
parents:
12940
diff
changeset
|
620 |
|
e068f228a24b
eliminated 1 to 2 message sends when raising
Claus Gittinger <cg@exept.de>
parents:
12940
diff
changeset
|
621 |
"Created: / 23-07-1999 / 14:07:33 / stefan" |
e068f228a24b
eliminated 1 to 2 message sends when raising
Claus Gittinger <cg@exept.de>
parents:
12940
diff
changeset
|
622 |
"Modified: / 10-08-2010 / 09:34:37 / cg" |
4481
f3f7e1af7489
added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
623 |
! |
f3f7e1af7489
added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
624 |
|
5684 | 625 |
raiseErrorString:aString in:aContext |
626 |
"raise a signal nonproceedable. |
|
8313
2aa626e8e404
Fix do not execute an exception handler inside the do-block, when the
Stefan Vogel <sv@exept.de>
parents:
8254
diff
changeset
|
627 |
The argument is used as messageText." |
5684 | 628 |
|
629 |
<context: #return> |
|
11026 | 630 |
<resource: #skipInDebuggersWalkBack> |
5684 | 631 |
|
13009
e068f228a24b
eliminated 1 to 2 message sends when raising
Claus Gittinger <cg@exept.de>
parents:
12940
diff
changeset
|
632 |
^ self basicNew |
16555 | 633 |
raiseErrorString:aString in:aContext |
13009
e068f228a24b
eliminated 1 to 2 message sends when raising
Claus Gittinger <cg@exept.de>
parents:
12940
diff
changeset
|
634 |
|
e068f228a24b
eliminated 1 to 2 message sends when raising
Claus Gittinger <cg@exept.de>
parents:
12940
diff
changeset
|
635 |
"Created: / 23-07-1999 / 14:07:33 / stefan" |
e068f228a24b
eliminated 1 to 2 message sends when raising
Claus Gittinger <cg@exept.de>
parents:
12940
diff
changeset
|
636 |
"Modified: / 10-08-2010 / 09:35:37 / cg" |
5684 | 637 |
! |
638 |
||
16555 | 639 |
raiseFrom:something |
4481
f3f7e1af7489
added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
640 |
"raise a signal nonproceedable. |
f3f7e1af7489
added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
641 |
The argument, something is passed both as parameter and originator." |
16555 | 642 |
|
4556 | 643 |
<context: #return> |
11026 | 644 |
<resource: #skipInDebuggersWalkBack> |
4556 | 645 |
|
8731 | 646 |
^ (self newException |
16555 | 647 |
suspendedContext:thisContext sender parameter:something originator:something) |
648 |
raise |
|
4481
f3f7e1af7489
added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
649 |
|
f3f7e1af7489
added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
650 |
"Modified: / 2.5.1996 / 16:36:38 / cg" |
f3f7e1af7489
added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
651 |
"Modified: / 5.3.1998 / 16:49:55 / stefan" |
f3f7e1af7489
added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
652 |
"Created: / 23.7.1999 / 14:07:59 / stefan" |
f3f7e1af7489
added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
653 |
! |
f3f7e1af7489
added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
654 |
|
14241 | 655 |
raiseIn:aContext |
656 |
"raise a signal nonproceedable. |
|
657 |
The signals notifierString is used as messageText." |
|
658 |
||
659 |
<context: #return> |
|
660 |
<resource: #skipInDebuggersWalkBack> |
|
661 |
||
662 |
^ self basicNew |
|
16555 | 663 |
raiseIn:aContext |
14241 | 664 |
|
665 |
"Created: / 27-01-2011 / 17:28:53 / cg" |
|
666 |
! |
|
667 |
||
4481
f3f7e1af7489
added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
668 |
raiseRequest |
f3f7e1af7489
added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
669 |
"raise a signal proceedable. |
8313
2aa626e8e404
Fix do not execute an exception handler inside the do-block, when the
Stefan Vogel <sv@exept.de>
parents:
8254
diff
changeset
|
670 |
The signals notifierString is used as messageText." |
4481
f3f7e1af7489
added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
671 |
|
4556 | 672 |
<context: #return> |
11026 | 673 |
<resource: #skipInDebuggersWalkBack> |
4556 | 674 |
|
13009
e068f228a24b
eliminated 1 to 2 message sends when raising
Claus Gittinger <cg@exept.de>
parents:
12940
diff
changeset
|
675 |
^ self basicNew |
16555 | 676 |
raiseRequestIn:thisContext sender |
13009
e068f228a24b
eliminated 1 to 2 message sends when raising
Claus Gittinger <cg@exept.de>
parents:
12940
diff
changeset
|
677 |
|
e068f228a24b
eliminated 1 to 2 message sends when raising
Claus Gittinger <cg@exept.de>
parents:
12940
diff
changeset
|
678 |
"Created: / 23-07-1999 / 14:08:24 / stefan" |
e068f228a24b
eliminated 1 to 2 message sends when raising
Claus Gittinger <cg@exept.de>
parents:
12940
diff
changeset
|
679 |
"Modified: / 10-08-2010 / 09:37:06 / cg" |
4481
f3f7e1af7489
added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
680 |
! |
f3f7e1af7489
added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
681 |
|
4758
91b5a25f29c5
added #raiseRequestErrorString
Claus Gittinger <cg@exept.de>
parents:
4676
diff
changeset
|
682 |
raiseRequestErrorString:aString |
91b5a25f29c5
added #raiseRequestErrorString
Claus Gittinger <cg@exept.de>
parents:
4676
diff
changeset
|
683 |
"raise a signal proceedable. |
8313
2aa626e8e404
Fix do not execute an exception handler inside the do-block, when the
Stefan Vogel <sv@exept.de>
parents:
8254
diff
changeset
|
684 |
The argument, aString is used as messageText." |
4758
91b5a25f29c5
added #raiseRequestErrorString
Claus Gittinger <cg@exept.de>
parents:
4676
diff
changeset
|
685 |
|
91b5a25f29c5
added #raiseRequestErrorString
Claus Gittinger <cg@exept.de>
parents:
4676
diff
changeset
|
686 |
<context: #return> |
11026 | 687 |
<resource: #skipInDebuggersWalkBack> |
4758
91b5a25f29c5
added #raiseRequestErrorString
Claus Gittinger <cg@exept.de>
parents:
4676
diff
changeset
|
688 |
|
13009
e068f228a24b
eliminated 1 to 2 message sends when raising
Claus Gittinger <cg@exept.de>
parents:
12940
diff
changeset
|
689 |
^ self basicNew |
16555 | 690 |
raiseRequestErrorString:aString in:thisContext sender |
13009
e068f228a24b
eliminated 1 to 2 message sends when raising
Claus Gittinger <cg@exept.de>
parents:
12940
diff
changeset
|
691 |
|
e068f228a24b
eliminated 1 to 2 message sends when raising
Claus Gittinger <cg@exept.de>
parents:
12940
diff
changeset
|
692 |
"Modified: / 10-08-2010 / 09:40:38 / cg" |
4758
91b5a25f29c5
added #raiseRequestErrorString
Claus Gittinger <cg@exept.de>
parents:
4676
diff
changeset
|
693 |
! |
91b5a25f29c5
added #raiseRequestErrorString
Claus Gittinger <cg@exept.de>
parents:
4676
diff
changeset
|
694 |
|
16555 | 695 |
raiseRequestFrom:something |
4481
f3f7e1af7489
added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
696 |
"raise a signal proceedable. |
f3f7e1af7489
added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
697 |
The argument, something is passed both as parameter and originator." |
16555 | 698 |
|
4556 | 699 |
<context: #return> |
11026 | 700 |
<resource: #skipInDebuggersWalkBack> |
4556 | 701 |
|
8731 | 702 |
^ (self newException |
16555 | 703 |
suspendedContext:thisContext sender parameter:something originator:something) |
704 |
raiseRequest |
|
4481
f3f7e1af7489
added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
705 |
|
f3f7e1af7489
added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
706 |
"Modified: / 2.5.1996 / 16:36:38 / cg" |
f3f7e1af7489
added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
707 |
"Modified: / 5.3.1998 / 16:52:46 / stefan" |
f3f7e1af7489
added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
708 |
"Created: / 23.7.1999 / 14:08:36 / stefan" |
f3f7e1af7489
added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
709 |
! |
f3f7e1af7489
added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
710 |
|
13248 | 711 |
raiseRequestIn:aContext |
712 |
"raise a signal proceedable. |
|
713 |
The signals notifierString is used as messageText." |
|
714 |
||
715 |
<context: #return> |
|
716 |
<resource: #skipInDebuggersWalkBack> |
|
717 |
||
718 |
^ self basicNew |
|
16555 | 719 |
raiseRequestIn:aContext |
13248 | 720 |
|
721 |
"Created: / 27-01-2011 / 17:28:53 / cg" |
|
722 |
! |
|
723 |
||
4481
f3f7e1af7489
added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
724 |
raiseRequestWith:aParameter |
f3f7e1af7489
added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
725 |
"raise a signal proceedable. |
8313
2aa626e8e404
Fix do not execute an exception handler inside the do-block, when the
Stefan Vogel <sv@exept.de>
parents:
8254
diff
changeset
|
726 |
The signals notifierString is used as messageText." |
4481
f3f7e1af7489
added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
727 |
|
4556 | 728 |
<context: #return> |
11026 | 729 |
<resource: #skipInDebuggersWalkBack> |
4556 | 730 |
|
13009
e068f228a24b
eliminated 1 to 2 message sends when raising
Claus Gittinger <cg@exept.de>
parents:
12940
diff
changeset
|
731 |
^ self basicNew |
16555 | 732 |
raiseRequestWith:aParameter in:thisContext sender |
13009
e068f228a24b
eliminated 1 to 2 message sends when raising
Claus Gittinger <cg@exept.de>
parents:
12940
diff
changeset
|
733 |
|
e068f228a24b
eliminated 1 to 2 message sends when raising
Claus Gittinger <cg@exept.de>
parents:
12940
diff
changeset
|
734 |
"Created: / 23-07-1999 / 14:08:48 / stefan" |
e068f228a24b
eliminated 1 to 2 message sends when raising
Claus Gittinger <cg@exept.de>
parents:
12940
diff
changeset
|
735 |
"Modified: / 10-08-2010 / 09:57:14 / cg" |
4481
f3f7e1af7489
added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
736 |
! |
f3f7e1af7489
added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
737 |
|
f3f7e1af7489
added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
738 |
raiseRequestWith:aParameter errorString:aString |
f3f7e1af7489
added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
739 |
"raise a signal proceedable. |
8313
2aa626e8e404
Fix do not execute an exception handler inside the do-block, when the
Stefan Vogel <sv@exept.de>
parents:
8254
diff
changeset
|
740 |
The argument, aString is used as messageText." |
4481
f3f7e1af7489
added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
741 |
|
4556 | 742 |
<context: #return> |
11026 | 743 |
<resource: #skipInDebuggersWalkBack> |
4556 | 744 |
|
13009
e068f228a24b
eliminated 1 to 2 message sends when raising
Claus Gittinger <cg@exept.de>
parents:
12940
diff
changeset
|
745 |
^ self basicNew |
16555 | 746 |
raiseRequestWith:aParameter errorString:aString in:thisContext sender |
13009
e068f228a24b
eliminated 1 to 2 message sends when raising
Claus Gittinger <cg@exept.de>
parents:
12940
diff
changeset
|
747 |
|
e068f228a24b
eliminated 1 to 2 message sends when raising
Claus Gittinger <cg@exept.de>
parents:
12940
diff
changeset
|
748 |
"Created: / 23-07-1999 / 14:08:57 / stefan" |
e068f228a24b
eliminated 1 to 2 message sends when raising
Claus Gittinger <cg@exept.de>
parents:
12940
diff
changeset
|
749 |
"Modified: / 10-08-2010 / 09:56:55 / cg" |
4481
f3f7e1af7489
added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
750 |
! |
f3f7e1af7489
added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
751 |
|
f3f7e1af7489
added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
752 |
raiseRequestWith:aParameter errorString:aString in:aContext |
f3f7e1af7489
added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
753 |
"raise a signal proceedable. |
8313
2aa626e8e404
Fix do not execute an exception handler inside the do-block, when the
Stefan Vogel <sv@exept.de>
parents:
8254
diff
changeset
|
754 |
The argument, aString is used as messageText. |
4481
f3f7e1af7489
added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
755 |
The additional context is passed as the context responsible for the raise, |
f3f7e1af7489
added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
756 |
allowing a raise to mimicri the exception happened somewhere else." |
f3f7e1af7489
added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
757 |
|
8733 | 758 |
<context: #return> |
11026 | 759 |
<resource: #skipInDebuggersWalkBack> |
8733 | 760 |
|
13009
e068f228a24b
eliminated 1 to 2 message sends when raising
Claus Gittinger <cg@exept.de>
parents:
12940
diff
changeset
|
761 |
^ self basicNew |
16555 | 762 |
raiseRequestWith:aParameter errorString:aString in:aContext |
13009
e068f228a24b
eliminated 1 to 2 message sends when raising
Claus Gittinger <cg@exept.de>
parents:
12940
diff
changeset
|
763 |
|
e068f228a24b
eliminated 1 to 2 message sends when raising
Claus Gittinger <cg@exept.de>
parents:
12940
diff
changeset
|
764 |
"Created: / 23-07-1999 / 14:09:07 / stefan" |
e068f228a24b
eliminated 1 to 2 message sends when raising
Claus Gittinger <cg@exept.de>
parents:
12940
diff
changeset
|
765 |
"Modified: / 10-08-2010 / 09:56:36 / cg" |
4481
f3f7e1af7489
added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
766 |
! |
f3f7e1af7489
added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
767 |
|
5259 | 768 |
raiseRequestWith:aParameter in:aContext |
769 |
"raise a signal proceedable. |
|
770 |
The additional context is passed as the context responsible for the raise, |
|
771 |
allowing a raise to mimicri the exception happened somewhere else." |
|
772 |
||
8733 | 773 |
<context: #return> |
11026 | 774 |
<resource: #skipInDebuggersWalkBack> |
8733 | 775 |
|
13009
e068f228a24b
eliminated 1 to 2 message sends when raising
Claus Gittinger <cg@exept.de>
parents:
12940
diff
changeset
|
776 |
^ self basicNew |
16555 | 777 |
raiseRequestWith:aParameter in:aContext |
13009
e068f228a24b
eliminated 1 to 2 message sends when raising
Claus Gittinger <cg@exept.de>
parents:
12940
diff
changeset
|
778 |
|
e068f228a24b
eliminated 1 to 2 message sends when raising
Claus Gittinger <cg@exept.de>
parents:
12940
diff
changeset
|
779 |
"Modified: / 10-08-2010 / 09:56:12 / cg" |
5259 | 780 |
! |
781 |
||
6174 | 782 |
raiseSignal |
783 |
"raise a signal (proceedable or not, whatever the proceedability is). |
|
8313
2aa626e8e404
Fix do not execute an exception handler inside the do-block, when the
Stefan Vogel <sv@exept.de>
parents:
8254
diff
changeset
|
784 |
The signals notifierString is used as messageText." |
6174 | 785 |
|
786 |
<context: #return> |
|
11026 | 787 |
<resource: #skipInDebuggersWalkBack> |
6174 | 788 |
|
8731 | 789 |
^ (self newException |
16555 | 790 |
suspendedContext:thisContext sender) |
791 |
raiseSignal |
|
6174 | 792 |
|
793 |
"Modified: / 10.11.2001 / 15:13:34 / cg" |
|
794 |
! |
|
795 |
||
8677 | 796 |
raiseSignal:errorMessage |
797 |
"ANSI: raise a signal (proceedable or not, whatever the proceedability is). |
|
798 |
The argument, errorMessage is used as messageText." |
|
799 |
||
800 |
<context: #return> |
|
11026 | 801 |
<resource: #skipInDebuggersWalkBack> |
8677 | 802 |
|
8731 | 803 |
^ (self newException |
16555 | 804 |
suspendedContext:thisContext sender errorString:errorMessage) |
805 |
raiseSignal. |
|
8677 | 806 |
|
807 |
"Modified: / 07-08-2004 / 19:24:00 / stefan" |
|
808 |
! |
|
809 |
||
810 |
raiseSignal:errorMessage with:aParameter |
|
811 |
"ANSI: raise a signal (proceedable or not, whatever the proceedability is). |
|
812 |
The argument, errorMessage is used as messageText." |
|
813 |
||
814 |
<context: #return> |
|
11026 | 815 |
<resource: #skipInDebuggersWalkBack> |
8677 | 816 |
|
8731 | 817 |
^ (self newException |
16555 | 818 |
suspendedContext:thisContext sender parameter:aParameter errorString:errorMessage) |
819 |
raiseSignal. |
|
8677 | 820 |
|
821 |
"Modified: / 07-08-2004 / 19:10:40 / stefan" |
|
822 |
! |
|
823 |
||
6430
9a1580465dd2
better impl. of #deferAfter:
Claus Gittinger <cg@exept.de>
parents:
6426
diff
changeset
|
824 |
raiseSignalErrorString:aString |
9a1580465dd2
better impl. of #deferAfter:
Claus Gittinger <cg@exept.de>
parents:
6426
diff
changeset
|
825 |
"raise a signal (proceedable or not, whatever the proceedability is). |
8313
2aa626e8e404
Fix do not execute an exception handler inside the do-block, when the
Stefan Vogel <sv@exept.de>
parents:
8254
diff
changeset
|
826 |
The argument, aString is used as messageText." |
6430
9a1580465dd2
better impl. of #deferAfter:
Claus Gittinger <cg@exept.de>
parents:
6426
diff
changeset
|
827 |
|
9a1580465dd2
better impl. of #deferAfter:
Claus Gittinger <cg@exept.de>
parents:
6426
diff
changeset
|
828 |
<context: #return> |
11026 | 829 |
<resource: #skipInDebuggersWalkBack> |
6430
9a1580465dd2
better impl. of #deferAfter:
Claus Gittinger <cg@exept.de>
parents:
6426
diff
changeset
|
830 |
|
8731 | 831 |
^ (self newException |
16555 | 832 |
suspendedContext:thisContext sender errorString:aString) |
833 |
raiseSignal. |
|
6430
9a1580465dd2
better impl. of #deferAfter:
Claus Gittinger <cg@exept.de>
parents:
6426
diff
changeset
|
834 |
! |
9a1580465dd2
better impl. of #deferAfter:
Claus Gittinger <cg@exept.de>
parents:
6426
diff
changeset
|
835 |
|
9a1580465dd2
better impl. of #deferAfter:
Claus Gittinger <cg@exept.de>
parents:
6426
diff
changeset
|
836 |
raiseSignalWith:aParameter |
9a1580465dd2
better impl. of #deferAfter:
Claus Gittinger <cg@exept.de>
parents:
6426
diff
changeset
|
837 |
"raise a signal (proceedable or not, whatever the proceedability is). |
9a1580465dd2
better impl. of #deferAfter:
Claus Gittinger <cg@exept.de>
parents:
6426
diff
changeset
|
838 |
The argument, aParameter is passed as parameter." |
9a1580465dd2
better impl. of #deferAfter:
Claus Gittinger <cg@exept.de>
parents:
6426
diff
changeset
|
839 |
|
9a1580465dd2
better impl. of #deferAfter:
Claus Gittinger <cg@exept.de>
parents:
6426
diff
changeset
|
840 |
<context: #return> |
11026 | 841 |
<resource: #skipInDebuggersWalkBack> |
6430
9a1580465dd2
better impl. of #deferAfter:
Claus Gittinger <cg@exept.de>
parents:
6426
diff
changeset
|
842 |
|
8731 | 843 |
^ (self newException |
16555 | 844 |
suspendedContext:thisContext sender parameter:aParameter) |
845 |
raiseSignal. |
|
6430
9a1580465dd2
better impl. of #deferAfter:
Claus Gittinger <cg@exept.de>
parents:
6426
diff
changeset
|
846 |
! |
9a1580465dd2
better impl. of #deferAfter:
Claus Gittinger <cg@exept.de>
parents:
6426
diff
changeset
|
847 |
|
9a1580465dd2
better impl. of #deferAfter:
Claus Gittinger <cg@exept.de>
parents:
6426
diff
changeset
|
848 |
raiseSignalWith:aParameter errorString:aString |
9a1580465dd2
better impl. of #deferAfter:
Claus Gittinger <cg@exept.de>
parents:
6426
diff
changeset
|
849 |
"raise a signal (proceedable or not, whatever the proceedability is). |
8617 | 850 |
The argument, aString is used as messageText, |
6430
9a1580465dd2
better impl. of #deferAfter:
Claus Gittinger <cg@exept.de>
parents:
6426
diff
changeset
|
851 |
aParameter is passed as exception parameter." |
9a1580465dd2
better impl. of #deferAfter:
Claus Gittinger <cg@exept.de>
parents:
6426
diff
changeset
|
852 |
|
9a1580465dd2
better impl. of #deferAfter:
Claus Gittinger <cg@exept.de>
parents:
6426
diff
changeset
|
853 |
<context: #return> |
11026 | 854 |
<resource: #skipInDebuggersWalkBack> |
6430
9a1580465dd2
better impl. of #deferAfter:
Claus Gittinger <cg@exept.de>
parents:
6426
diff
changeset
|
855 |
|
8731 | 856 |
^ (self newException |
16555 | 857 |
suspendedContext:thisContext sender parameter:aParameter errorString:aString) |
858 |
raiseSignal. |
|
6430
9a1580465dd2
better impl. of #deferAfter:
Claus Gittinger <cg@exept.de>
parents:
6426
diff
changeset
|
859 |
! |
9a1580465dd2
better impl. of #deferAfter:
Claus Gittinger <cg@exept.de>
parents:
6426
diff
changeset
|
860 |
|
4481
f3f7e1af7489
added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
861 |
raiseWith:aParameter |
f3f7e1af7489
added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
862 |
"raise a signal nonproceedable. |
f3f7e1af7489
added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
863 |
The argument, aParameter is passed as parameter." |
f3f7e1af7489
added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
864 |
|
4556 | 865 |
<context: #return> |
11026 | 866 |
<resource: #skipInDebuggersWalkBack> |
4556 | 867 |
|
13009
e068f228a24b
eliminated 1 to 2 message sends when raising
Claus Gittinger <cg@exept.de>
parents:
12940
diff
changeset
|
868 |
^ self basicNew |
16555 | 869 |
raiseWith:aParameter in:thisContext sender |
13009
e068f228a24b
eliminated 1 to 2 message sends when raising
Claus Gittinger <cg@exept.de>
parents:
12940
diff
changeset
|
870 |
|
e068f228a24b
eliminated 1 to 2 message sends when raising
Claus Gittinger <cg@exept.de>
parents:
12940
diff
changeset
|
871 |
"Created: / 23-07-1999 / 14:09:27 / stefan" |
e068f228a24b
eliminated 1 to 2 message sends when raising
Claus Gittinger <cg@exept.de>
parents:
12940
diff
changeset
|
872 |
"Modified: / 10-08-2010 / 09:51:11 / cg" |
4481
f3f7e1af7489
added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
873 |
! |
f3f7e1af7489
added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
874 |
|
f3f7e1af7489
added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
875 |
raiseWith:aParameter errorString:aString |
f3f7e1af7489
added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
876 |
"raise a signal nonproceedable. |
8617 | 877 |
The argument, aString is used as messageText, |
6430
9a1580465dd2
better impl. of #deferAfter:
Claus Gittinger <cg@exept.de>
parents:
6426
diff
changeset
|
878 |
aParameter is passed as exception parameter." |
4481
f3f7e1af7489
added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
879 |
|
4556 | 880 |
<context: #return> |
11026 | 881 |
<resource: #skipInDebuggersWalkBack> |
4556 | 882 |
|
13009
e068f228a24b
eliminated 1 to 2 message sends when raising
Claus Gittinger <cg@exept.de>
parents:
12940
diff
changeset
|
883 |
^ self basicNew |
16555 | 884 |
raiseWith:aParameter errorString:aString in:thisContext sender. |
13009
e068f228a24b
eliminated 1 to 2 message sends when raising
Claus Gittinger <cg@exept.de>
parents:
12940
diff
changeset
|
885 |
|
e068f228a24b
eliminated 1 to 2 message sends when raising
Claus Gittinger <cg@exept.de>
parents:
12940
diff
changeset
|
886 |
"Created: / 23-07-1999 / 14:09:36 / stefan" |
e068f228a24b
eliminated 1 to 2 message sends when raising
Claus Gittinger <cg@exept.de>
parents:
12940
diff
changeset
|
887 |
"Modified: / 10-08-2010 / 09:52:59 / cg" |
4481
f3f7e1af7489
added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
888 |
! |
f3f7e1af7489
added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
889 |
|
f3f7e1af7489
added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
890 |
raiseWith:aParameter errorString:aString in:aContext |
f3f7e1af7489
added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
891 |
"raise a signal nonproceedable. |
8313
2aa626e8e404
Fix do not execute an exception handler inside the do-block, when the
Stefan Vogel <sv@exept.de>
parents:
8254
diff
changeset
|
892 |
The argument, aString is used as messageText, aParameter is passed |
4481
f3f7e1af7489
added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
893 |
as exception parameter. |
f3f7e1af7489
added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
894 |
The additional context is passed as the context responsible for the raise, |
f3f7e1af7489
added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
895 |
allowing a raise to mimicri the exception happened somewhere else." |
f3f7e1af7489
added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
896 |
|
8733 | 897 |
<context: #return> |
11026 | 898 |
<resource: #skipInDebuggersWalkBack> |
8733 | 899 |
|
13009
e068f228a24b
eliminated 1 to 2 message sends when raising
Claus Gittinger <cg@exept.de>
parents:
12940
diff
changeset
|
900 |
^ self basicNew |
16555 | 901 |
raiseWith:aParameter errorString:aString in:aContext. |
13009
e068f228a24b
eliminated 1 to 2 message sends when raising
Claus Gittinger <cg@exept.de>
parents:
12940
diff
changeset
|
902 |
|
e068f228a24b
eliminated 1 to 2 message sends when raising
Claus Gittinger <cg@exept.de>
parents:
12940
diff
changeset
|
903 |
"Created: / 23-07-1999 / 14:09:46 / stefan" |
e068f228a24b
eliminated 1 to 2 message sends when raising
Claus Gittinger <cg@exept.de>
parents:
12940
diff
changeset
|
904 |
"Modified: / 10-08-2010 / 09:52:10 / cg" |
8677 | 905 |
! |
906 |
||
10753 | 907 |
raiseWith:aParameter in:aContext |
908 |
"raise a signal nonproceedable. |
|
909 |
The argument, aParameter is passed as exception parameter. |
|
910 |
The additional context is passed as the context responsible for the raise, |
|
911 |
allowing a raise to mimicri the exception happened somewhere else." |
|
912 |
||
913 |
<context: #return> |
|
11026 | 914 |
<resource: #skipInDebuggersWalkBack> |
10753 | 915 |
|
13009
e068f228a24b
eliminated 1 to 2 message sends when raising
Claus Gittinger <cg@exept.de>
parents:
12940
diff
changeset
|
916 |
^ self basicNew |
16555 | 917 |
raiseWith:aParameter in:aContext |
13009
e068f228a24b
eliminated 1 to 2 message sends when raising
Claus Gittinger <cg@exept.de>
parents:
12940
diff
changeset
|
918 |
|
e068f228a24b
eliminated 1 to 2 message sends when raising
Claus Gittinger <cg@exept.de>
parents:
12940
diff
changeset
|
919 |
"Modified: / 10-08-2010 / 09:52:38 / cg" |
4481
f3f7e1af7489
added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
920 |
! ! |
f3f7e1af7489
added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
921 |
|
8677 | 922 |
!GenericException class methodsFor:'save evaluation'! |
4481
f3f7e1af7489
added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
923 |
|
f3f7e1af7489
added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
924 |
catch:aBlock |
4496 | 925 |
"evaluate the argument, aBlock. |
10239 | 926 |
If the receiver-exception is raised during evaluation, abort |
8617 | 927 |
the evaluation and return true; otherwise return false. |
4496 | 928 |
This is the catch & throw mechanism found in other languages, |
20261 | 929 |
where the returned value indicates if an exception occurred." |
4481
f3f7e1af7489
added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
930 |
|
4496 | 931 |
|raiseOccurred| |
4481
f3f7e1af7489
added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
932 |
|
4496 | 933 |
raiseOccurred := false. |
934 |
self handle:[:ex | raiseOccurred := true. ex return] do:aBlock. |
|
935 |
^ raiseOccurred |
|
4481
f3f7e1af7489
added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
936 |
|
4496 | 937 |
" |
938 |
Object messageNotUnderstoodSignal catch:[ |
|
20261 | 939 |
123 size open |
8617 | 940 |
] |
4496 | 941 |
" |
4481
f3f7e1af7489
added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
942 |
|
10239 | 943 |
"Created: / 23-07-1999 / 14:06:01 / stefan" |
944 |
"Modified: / 07-12-2006 / 17:05:17 / cg" |
|
4481
f3f7e1af7489
added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
945 |
! |
f3f7e1af7489
added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
946 |
|
6396
74d5b0b588a6
added deferAfter: - defer exceptions until some later time
Claus Gittinger <cg@exept.de>
parents:
6364
diff
changeset
|
947 |
deferAfter:aBlock |
74d5b0b588a6
added deferAfter: - defer exceptions until some later time
Claus Gittinger <cg@exept.de>
parents:
6364
diff
changeset
|
948 |
"evaluate the argument, aBlock. |
10239 | 949 |
Ignore the receiver-exception during evaluation - i.e. simply continue, |
6396
74d5b0b588a6
added deferAfter: - defer exceptions until some later time
Claus Gittinger <cg@exept.de>
parents:
6364
diff
changeset
|
950 |
but remember if the signal was raised. |
74d5b0b588a6
added deferAfter: - defer exceptions until some later time
Claus Gittinger <cg@exept.de>
parents:
6364
diff
changeset
|
951 |
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:
6364
diff
changeset
|
952 |
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:
6364
diff
changeset
|
953 |
and only a single raise is performed after the blocks evaluation. |
74d5b0b588a6
added deferAfter: - defer exceptions until some later time
Claus Gittinger <cg@exept.de>
parents:
6364
diff
changeset
|
954 |
|
8617 | 955 |
Deferring makes sense for some signals, such as UserInterrupt or AbortSignal, |
956 |
which must occasionally be delayed temporarily until a save place is reached |
|
20800 | 957 |
(especially when packages are sent across a communication channel, and you don't want |
6396
74d5b0b588a6
added deferAfter: - defer exceptions until some later time
Claus Gittinger <cg@exept.de>
parents:
6364
diff
changeset
|
958 |
partial packages to be generated by user interruptions)." |
74d5b0b588a6
added deferAfter: - defer exceptions until some later time
Claus Gittinger <cg@exept.de>
parents:
6364
diff
changeset
|
959 |
|
16555 | 960 |
|caughtException result| |
6396
74d5b0b588a6
added deferAfter: - defer exceptions until some later time
Claus Gittinger <cg@exept.de>
parents:
6364
diff
changeset
|
961 |
|
74d5b0b588a6
added deferAfter: - defer exceptions until some later time
Claus Gittinger <cg@exept.de>
parents:
6364
diff
changeset
|
962 |
self handle:[:ex | |
20800 | 963 |
caughtException isNil ifTrue:[ |
964 |
caughtException := ex. |
|
965 |
]. |
|
966 |
ex proceedWith:nil |
|
6396
74d5b0b588a6
added deferAfter: - defer exceptions until some later time
Claus Gittinger <cg@exept.de>
parents:
6364
diff
changeset
|
967 |
] do:[ |
20800 | 968 |
result := aBlock value. |
6396
74d5b0b588a6
added deferAfter: - defer exceptions until some later time
Claus Gittinger <cg@exept.de>
parents:
6364
diff
changeset
|
969 |
]. |
16555 | 970 |
caughtException notNil ifTrue:[ |
20800 | 971 |
caughtException suspendedContext:thisContext. |
972 |
||
973 |
"/ the exception was raised during the execution of aBlock above. |
|
974 |
"/ Raise it now (delayed). |
|
975 |
caughtException raiseSignal. |
|
6396
74d5b0b588a6
added deferAfter: - defer exceptions until some later time
Claus Gittinger <cg@exept.de>
parents:
6364
diff
changeset
|
976 |
]. |
74d5b0b588a6
added deferAfter: - defer exceptions until some later time
Claus Gittinger <cg@exept.de>
parents:
6364
diff
changeset
|
977 |
^ result |
74d5b0b588a6
added deferAfter: - defer exceptions until some later time
Claus Gittinger <cg@exept.de>
parents:
6364
diff
changeset
|
978 |
|
6430
9a1580465dd2
better impl. of #deferAfter:
Claus Gittinger <cg@exept.de>
parents:
6426
diff
changeset
|
979 |
" |
9a1580465dd2
better impl. of #deferAfter:
Claus Gittinger <cg@exept.de>
parents:
6426
diff
changeset
|
980 |
UserInterrupt deferAfter:[ |
20800 | 981 |
Transcript showCR:'1 - now raising, but will be deferred.'. |
982 |
UserInterrupt raiseRequestWith:'hello'. |
|
983 |
Transcript showCR:'2 - after the raise, deferred exception will be handled soon.'. |
|
6430
9a1580465dd2
better impl. of #deferAfter:
Claus Gittinger <cg@exept.de>
parents:
6426
diff
changeset
|
984 |
]. |
9a1580465dd2
better impl. of #deferAfter:
Claus Gittinger <cg@exept.de>
parents:
6426
diff
changeset
|
985 |
Transcript showCR:'3 - here after the protected block.'. |
9a1580465dd2
better impl. of #deferAfter:
Claus Gittinger <cg@exept.de>
parents:
6426
diff
changeset
|
986 |
" |
10239 | 987 |
|
988 |
"Modified: / 07-12-2006 / 17:05:28 / cg" |
|
6396
74d5b0b588a6
added deferAfter: - defer exceptions until some later time
Claus Gittinger <cg@exept.de>
parents:
6364
diff
changeset
|
989 |
! |
74d5b0b588a6
added deferAfter: - defer exceptions until some later time
Claus Gittinger <cg@exept.de>
parents:
6364
diff
changeset
|
990 |
|
12059 | 991 |
evaluate:aBlock ifRaised:exceptionValue |
992 |
"evaluate the argument, aBlock and return its value. |
|
993 |
If the receiver-signal is raised during evaluation, abort |
|
16555 | 994 |
the evaluation and return the value from exceptionValue. |
12059 | 995 |
This is similar to the catch & throw mechanism found in other languages" |
996 |
||
997 |
^ self handle:[:ex | exceptionValue value] do:aBlock. |
|
998 |
||
999 |
" |
|
16555 | 1000 |
Object messageNotUnderstoodSignal |
1001 |
evaluate:[ 123 size open ] |
|
1002 |
ifRaised:345 |
|
12059 | 1003 |
" |
1004 |
! |
|
1005 |
||
4481
f3f7e1af7489
added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1006 |
handle:handleBlock do:aBlock |
f3f7e1af7489
added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1007 |
"evaluate the argument, aBlock. |
10239 | 1008 |
If the receiver-exception is raised during evaluation, |
4481
f3f7e1af7489
added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1009 |
evaluate the handleBlock passing it an Exception argument. |
f3f7e1af7489
added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1010 |
The handler may decide how to react to the signal by sending |
f3f7e1af7489
added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1011 |
a corresponding message to the exception (see there). |
f3f7e1af7489
added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1012 |
If the signal is not raised, return the value of evaluating |
f3f7e1af7489
added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1013 |
aBlock." |
f3f7e1af7489
added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1014 |
|
4548
8349abc6b796
Add #handlerProtectedBlock:inContext
Stefan Vogel <sv@exept.de>
parents:
4544
diff
changeset
|
1015 |
<context: #return> |
4488
db914d752859
must mark returned contexts as returnable
Claus Gittinger <cg@exept.de>
parents:
4484
diff
changeset
|
1016 |
<exception: #handle> |
db914d752859
must mark returned contexts as returnable
Claus Gittinger <cg@exept.de>
parents:
4484
diff
changeset
|
1017 |
|
4491
5041cae5651c
use new pragma to flag exception frames.
Claus Gittinger <cg@exept.de>
parents:
4488
diff
changeset
|
1018 |
"/ thisContext markForHandle. -- same as above pragma |
5041cae5651c
use new pragma to flag exception frames.
Claus Gittinger <cg@exept.de>
parents:
4488
diff
changeset
|
1019 |
^ aBlock value "the real logic is in Exception>>doRaise" |
4481
f3f7e1af7489
added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1020 |
|
4491
5041cae5651c
use new pragma to flag exception frames.
Claus Gittinger <cg@exept.de>
parents:
4488
diff
changeset
|
1021 |
" |
5041cae5651c
use new pragma to flag exception frames.
Claus Gittinger <cg@exept.de>
parents:
4488
diff
changeset
|
1022 |
Object messageNotUnderstoodSignal handle:[:ex | |
16555 | 1023 |
'oops' printNL. |
1024 |
ex return |
|
4491
5041cae5651c
use new pragma to flag exception frames.
Claus Gittinger <cg@exept.de>
parents:
4488
diff
changeset
|
1025 |
] do:[ |
16555 | 1026 |
123 size open |
4491
5041cae5651c
use new pragma to flag exception frames.
Claus Gittinger <cg@exept.de>
parents:
4488
diff
changeset
|
1027 |
] |
5041cae5651c
use new pragma to flag exception frames.
Claus Gittinger <cg@exept.de>
parents:
4488
diff
changeset
|
1028 |
" |
4481
f3f7e1af7489
added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1029 |
|
4491
5041cae5651c
use new pragma to flag exception frames.
Claus Gittinger <cg@exept.de>
parents:
4488
diff
changeset
|
1030 |
" |
5041cae5651c
use new pragma to flag exception frames.
Claus Gittinger <cg@exept.de>
parents:
4488
diff
changeset
|
1031 |
|num| |
4481
f3f7e1af7489
added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1032 |
|
4491
5041cae5651c
use new pragma to flag exception frames.
Claus Gittinger <cg@exept.de>
parents:
4488
diff
changeset
|
1033 |
num := 0. |
5041cae5651c
use new pragma to flag exception frames.
Claus Gittinger <cg@exept.de>
parents:
4488
diff
changeset
|
1034 |
Number divisionByZeroSignal handle:[:ex | |
16555 | 1035 |
'oops' printNL. |
1036 |
ex return |
|
4491
5041cae5651c
use new pragma to flag exception frames.
Claus Gittinger <cg@exept.de>
parents:
4488
diff
changeset
|
1037 |
] do:[ |
16555 | 1038 |
123 / num |
4491
5041cae5651c
use new pragma to flag exception frames.
Claus Gittinger <cg@exept.de>
parents:
4488
diff
changeset
|
1039 |
] |
5041cae5651c
use new pragma to flag exception frames.
Claus Gittinger <cg@exept.de>
parents:
4488
diff
changeset
|
1040 |
" |
4481
f3f7e1af7489
added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1041 |
|
10239 | 1042 |
"Created: / 23-07-1999 / 14:06:13 / stefan" |
1043 |
"Modified: / 25-07-1999 / 19:44:05 / stefan" |
|
1044 |
"Modified: / 07-12-2006 / 17:05:30 / cg" |
|
4481
f3f7e1af7489
added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1045 |
! |
f3f7e1af7489
added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1046 |
|
f3f7e1af7489
added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1047 |
handle:handleBlock from:anObject do:aBlock |
f3f7e1af7489
added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1048 |
"evaluate the argument, aBlock. |
10239 | 1049 |
If the receiver-exception is raised during evaluation, |
4481
f3f7e1af7489
added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1050 |
and the exception originated from anObject, |
f3f7e1af7489
added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1051 |
evaluate the handleBlock passing it an Exception argument. |
f3f7e1af7489
added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1052 |
The handler may decide how to react to the signal by sending |
f3f7e1af7489
added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1053 |
a corresponding message to the exception (see there). |
f3f7e1af7489
added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1054 |
If the signal is not raised, return the value of evaluating |
f3f7e1af7489
added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1055 |
aBlock." |
f3f7e1af7489
added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1056 |
|
4548
8349abc6b796
Add #handlerProtectedBlock:inContext
Stefan Vogel <sv@exept.de>
parents:
4544
diff
changeset
|
1057 |
<context: #return> |
4488
db914d752859
must mark returned contexts as returnable
Claus Gittinger <cg@exept.de>
parents:
4484
diff
changeset
|
1058 |
<exception: #handle> |
db914d752859
must mark returned contexts as returnable
Claus Gittinger <cg@exept.de>
parents:
4484
diff
changeset
|
1059 |
|
4491
5041cae5651c
use new pragma to flag exception frames.
Claus Gittinger <cg@exept.de>
parents:
4488
diff
changeset
|
1060 |
"/ thisContext markForHandle. -- same as above pragma |
5041cae5651c
use new pragma to flag exception frames.
Claus Gittinger <cg@exept.de>
parents:
4488
diff
changeset
|
1061 |
^ aBlock value "the real logic is in Exception>>doRaise" |
4481
f3f7e1af7489
added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1062 |
|
4491
5041cae5651c
use new pragma to flag exception frames.
Claus Gittinger <cg@exept.de>
parents:
4488
diff
changeset
|
1063 |
" |
5041cae5651c
use new pragma to flag exception frames.
Claus Gittinger <cg@exept.de>
parents:
4488
diff
changeset
|
1064 |
the first open will be caught; the second not: |
4481
f3f7e1af7489
added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1065 |
|
4491
5041cae5651c
use new pragma to flag exception frames.
Claus Gittinger <cg@exept.de>
parents:
4488
diff
changeset
|
1066 |
|o1 o2| |
4481
f3f7e1af7489
added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1067 |
|
4491
5041cae5651c
use new pragma to flag exception frames.
Claus Gittinger <cg@exept.de>
parents:
4488
diff
changeset
|
1068 |
o1 := 123. |
5041cae5651c
use new pragma to flag exception frames.
Claus Gittinger <cg@exept.de>
parents:
4488
diff
changeset
|
1069 |
o2 := nil. |
8617 | 1070 |
Object messageNotUnderstoodSignal |
16555 | 1071 |
handle: |
1072 |
[:ex | |
|
1073 |
'oops' printNL. |
|
1074 |
ex proceed |
|
1075 |
] |
|
1076 |
from:o1 |
|
1077 |
do: |
|
1078 |
[ |
|
1079 |
o1 open. |
|
1080 |
o2 open |
|
1081 |
] |
|
4491
5041cae5651c
use new pragma to flag exception frames.
Claus Gittinger <cg@exept.de>
parents:
4488
diff
changeset
|
1082 |
" |
4481
f3f7e1af7489
added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1083 |
|
10239 | 1084 |
"Created: / 23-07-1999 / 14:06:26 / stefan" |
1085 |
"Modified: / 25-07-1999 / 19:44:13 / stefan" |
|
1086 |
"Modified: / 07-12-2006 / 17:05:33 / cg" |
|
4481
f3f7e1af7489
added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1087 |
! |
f3f7e1af7489
added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1088 |
|
f3f7e1af7489
added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1089 |
ignoreIn:aBlock |
4496 | 1090 |
"evaluate the argument, aBlock. |
21856 | 1091 |
Ignore the receiver-exception during evaluation - i.e. simply continue with the default resume value. |
4496 | 1092 |
This makes only sense for some signals, such as UserInterrupt |
21567 | 1093 |
or AbortOperationRequest, because continuing after an exception without any cleanup |
4496 | 1094 |
often leads to followup-errors." |
4481
f3f7e1af7489
added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1095 |
|
21856 | 1096 |
^ self handle:[:ex | ex proceed] do:aBlock. |
4481
f3f7e1af7489
added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1097 |
|
4496 | 1098 |
" |
1099 |
Object messageNotUnderstoodSignal ignoreIn:[ |
|
21567 | 1100 |
123 size open |
4496 | 1101 |
] |
21856 | 1102 |
|
1103 |
DomainError ignoreIn:[ -1.0 log10 ] |
|
4496 | 1104 |
" |
4481
f3f7e1af7489
added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1105 |
|
10239 | 1106 |
"Created: / 23-07-1999 / 14:06:40 / stefan" |
21567 | 1107 |
"Modified (comment): / 24-02-2017 / 11:15:44 / stefan" |
21856 | 1108 |
"Modified (comment): / 20-06-2017 / 13:35:03 / cg" |
4481
f3f7e1af7489
added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1109 |
! ! |
f3f7e1af7489
added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1110 |
|
8677 | 1111 |
!GenericException class methodsFor:'testing'! |
6200 | 1112 |
|
21038 | 1113 |
isAbstract |
1114 |
^ self == GenericException |
|
1115 |
! |
|
1116 |
||
6200 | 1117 |
isControlInterrupt |
1118 |
^ false |
|
1119 |
||
1120 |
"Created: / 16.11.2001 / 16:11:54 / cg" |
|
4936 | 1121 |
! |
1122 |
||
8677 | 1123 |
isExceptionCreator |
1124 |
"return true, if the receiver can create exceptions, |
|
1125 |
this includes #raise, #raiseRequest as well as the behavior of |
|
1126 |
an exception handler, such as the #accepts: and #handles: messages" |
|
8254
73b6109ab982
Use Timestamp/#asTimestamp instead of AbsoluteTime/#asAbsoluteTime
Stefan Vogel <sv@exept.de>
parents:
8238
diff
changeset
|
1127 |
|
8677 | 1128 |
^ true |
4936 | 1129 |
! |
1130 |
||
8677 | 1131 |
isExceptionHandler |
1132 |
"return true, if the receiver responds to the exception handler protocol, |
|
1133 |
especially to the #accepts: and #handles: messages" |
|
8254
73b6109ab982
Use Timestamp/#asTimestamp instead of AbsoluteTime/#asAbsoluteTime
Stefan Vogel <sv@exept.de>
parents:
8238
diff
changeset
|
1134 |
|
8677 | 1135 |
^ true |
8254
73b6109ab982
Use Timestamp/#asTimestamp instead of AbsoluteTime/#asAbsoluteTime
Stefan Vogel <sv@exept.de>
parents:
8238
diff
changeset
|
1136 |
|
8677 | 1137 |
"Created: / 23.7.1999 / 13:49:59 / stefan" |
4936 | 1138 |
! |
1139 |
||
20436 | 1140 |
isProgramError |
1141 |
"redefined in all exceptions which are programmer's errors, |
|
1142 |
and which should probably not be ignored. |
|
1143 |
I.e. a global error handler should reject and let a debugger get control." |
|
1144 |
||
1145 |
^ false |
|
1146 |
! |
|
1147 |
||
8677 | 1148 |
isQuerySignal |
1149 |
"return true, if this is a querySignal - always return false here" |
|
4936 | 1150 |
|
8677 | 1151 |
^ false |
4936 | 1152 |
|
8677 | 1153 |
"Created: / 23.7.1999 / 13:50:16 / stefan" |
5058
42e732f3497c
added another useful handler
Claus Gittinger <cg@exept.de>
parents:
4936
diff
changeset
|
1154 |
! |
42e732f3497c
added another useful handler
Claus Gittinger <cg@exept.de>
parents:
4936
diff
changeset
|
1155 |
|
8677 | 1156 |
mayProceed |
1157 |
"return true, if the exception handler is allowed to proceed |
|
20261 | 1158 |
the execution where the exception occurred. |
8390
d78cd984f201
return values for #proceedWith:
Stefan Vogel <sv@exept.de>
parents:
8313
diff
changeset
|
1159 |
|
8677 | 1160 |
Subclasses may redefine this." |
5058
42e732f3497c
added another useful handler
Claus Gittinger <cg@exept.de>
parents:
4936
diff
changeset
|
1161 |
|
8677 | 1162 |
^ true |
5058
42e732f3497c
added another useful handler
Claus Gittinger <cg@exept.de>
parents:
4936
diff
changeset
|
1163 |
|
8677 | 1164 |
"Modified: / 23.7.1999 / 14:50:11 / stefan" |
4936 | 1165 |
! ! |
1166 |
||
14962 | 1167 |
|
7261 | 1168 |
!GenericException methodsFor:'Compatibility-ANSI'! |
5680 | 1169 |
|
5933
af2939dac9bf
added #pass for compatibility
Claus Gittinger <cg@exept.de>
parents:
5927
diff
changeset
|
1170 |
pass |
16157 | 1171 |
"same as reject - for ANSI compatibility" |
1172 |
||
5933
af2939dac9bf
added #pass for compatibility
Claus Gittinger <cg@exept.de>
parents:
5927
diff
changeset
|
1173 |
^ self reject |
af2939dac9bf
added #pass for compatibility
Claus Gittinger <cg@exept.de>
parents:
5927
diff
changeset
|
1174 |
! |
af2939dac9bf
added #pass for compatibility
Claus Gittinger <cg@exept.de>
parents:
5927
diff
changeset
|
1175 |
|
5985 | 1176 |
retry |
1177 |
"same as #restart - ANSI & VW compatibility" |
|
1178 |
||
1179 |
self restart |
|
1180 |
||
1181 |
"Created: / 7.9.2001 / 13:31:02 / cg" |
|
1182 |
! |
|
1183 |
||
7674 | 1184 |
retryUsing: alternativeBlock |
1185 |
"Abort an exception handler and evaluate a new block in place of the handler's protected block." |
|
1186 |
||
1187 |
"/ self mustBeHandled ifFalse: [ ^self ]. |
|
1188 |
||
1189 |
^ self restartDo:alternativeBlock |
|
1190 |
! |
|
1191 |
||
15123 | 1192 |
signalWith:messageTextArg |
1193 |
"raise a signal proceedable or nonproceedable (whichever is right). |
|
1194 |
The argument is used as messageText. |
|
1195 |
ANSI compatibility." |
|
1196 |
||
1197 |
self messageText:messageTextArg. |
|
8677 | 1198 |
^ self raise |
5697
ce78c7d9ddbd
raiseSignal / raiseSignal: / raiseSignal:with:
Claus Gittinger <cg@exept.de>
parents:
5684
diff
changeset
|
1199 |
! ! |
5680 | 1200 |
|
12559 | 1201 |
!GenericException methodsFor:'Compatibility-Dolphin'! |
1202 |
||
1203 |
stackTrace:numberOfFrames |
|
12561 | 1204 |
"return a backtrace information string" |
12559 | 1205 |
|
1206 |
|con| |
|
1207 |
||
1208 |
con := suspendedContext. |
|
12560 | 1209 |
^ ((1 to:numberOfFrames) |
16555 | 1210 |
collect:[:idx | |
1211 |
|s| |
|
1212 |
||
1213 |
s := con printString. |
|
1214 |
con := con sender. |
|
1215 |
s |
|
1216 |
]) asStringWith:Character cr. |
|
12559 | 1217 |
|
1218 |
" |
|
1219 |
Error handle:[:ex | |
|
16555 | 1220 |
(ex stackTrace:20) inspect. |
12559 | 1221 |
] do:[ |
16555 | 1222 |
self error |
12559 | 1223 |
]. |
1224 |
" |
|
1225 |
! ! |
|
1226 |
||
12572 | 1227 |
!GenericException methodsFor:'Compatibility-Squeak'! |
1228 |
||
1229 |
signalerContext |
|
20699 | 1230 |
"return the context in which the raise occurred. |
1231 |
Same as suspendedContext, for squeak compatibility" |
|
1232 |
||
12572 | 1233 |
^ self suspendedContext |
1234 |
! ! |
|
1235 |
||
13055 | 1236 |
!GenericException methodsFor:'Compatibility-V''Age'! |
1237 |
||
1238 |
exitWith:value |
|
16224 | 1239 |
"return with a value. |
1240 |
V'AGE compatibility." |
|
1241 |
||
13055 | 1242 |
^ self return:value |
1243 |
||
1244 |
"Created: / 28-08-2010 / 14:43:23 / cg" |
|
1245 |
! ! |
|
1246 |
||
4481
f3f7e1af7489
added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1247 |
!GenericException methodsFor:'accessing'! |
f3f7e1af7489
added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1248 |
|
10777 | 1249 |
catchInDebugger |
1250 |
"if set, the debugger will handle this signal in its event loop and will close itself |
|
1251 |
without asking for close-confirmation. |
|
1252 |
This allows for debugged processes to be terminated without a user confirmation dialog |
|
1253 |
(for now, this is used in expecco's hard-terminate function to shut down any open debuggers |
|
11710
8e6d1d366d30
added dummy catchInDebugger
Claus Gittinger <cg@exept.de>
parents:
11640
diff
changeset
|
1254 |
together with the test-process). |
8e6d1d366d30
added dummy catchInDebugger
Claus Gittinger <cg@exept.de>
parents:
11640
diff
changeset
|
1255 |
Dummy here" |
10777 | 1256 |
|
1257 |
^ false |
|
1258 |
! |
|
1259 |
||
11710
8e6d1d366d30
added dummy catchInDebugger
Claus Gittinger <cg@exept.de>
parents:
11640
diff
changeset
|
1260 |
catchInDebugger:aBoolean |
8e6d1d366d30
added dummy catchInDebugger
Claus Gittinger <cg@exept.de>
parents:
11640
diff
changeset
|
1261 |
"if set, the debugger will handle this signal in its event loop and will close itself |
8e6d1d366d30
added dummy catchInDebugger
Claus Gittinger <cg@exept.de>
parents:
11640
diff
changeset
|
1262 |
without asking for close-confirmation. |
8e6d1d366d30
added dummy catchInDebugger
Claus Gittinger <cg@exept.de>
parents:
11640
diff
changeset
|
1263 |
This allows for debugged processes to be terminated without a user confirmation dialog |
8e6d1d366d30
added dummy catchInDebugger
Claus Gittinger <cg@exept.de>
parents:
11640
diff
changeset
|
1264 |
(for now, this is used in expecco's hard-terminate function to shut down any open debuggers |
8e6d1d366d30
added dummy catchInDebugger
Claus Gittinger <cg@exept.de>
parents:
11640
diff
changeset
|
1265 |
together with the test-process). |
8e6d1d366d30
added dummy catchInDebugger
Claus Gittinger <cg@exept.de>
parents:
11640
diff
changeset
|
1266 |
Dummy here" |
8e6d1d366d30
added dummy catchInDebugger
Claus Gittinger <cg@exept.de>
parents:
11640
diff
changeset
|
1267 |
|
8e6d1d366d30
added dummy catchInDebugger
Claus Gittinger <cg@exept.de>
parents:
11640
diff
changeset
|
1268 |
"/ ignored |
8e6d1d366d30
added dummy catchInDebugger
Claus Gittinger <cg@exept.de>
parents:
11640
diff
changeset
|
1269 |
! |
8e6d1d366d30
added dummy catchInDebugger
Claus Gittinger <cg@exept.de>
parents:
11640
diff
changeset
|
1270 |
|
4562 | 1271 |
creator |
16555 | 1272 |
"return the creator of the exception. |
16500 | 1273 |
For class based exceptions, that is the exception class; |
1274 |
for signals, that is the signal itself. |
|
18727 | 1275 |
This used to be called 'signal' in earlier versions, |
20261 | 1276 |
but due to the conflict with VSE, Squeak and others, |
18727 | 1277 |
where 'signal' means 'raise', 'signal' was obsoleted by this method." |
15336 | 1278 |
|
1279 |
signal notNil ifTrue:[^ signal] ifFalse:[^ self class] |
|
4562 | 1280 |
! |
1281 |
||
8617 | 1282 |
errorString |
4481
f3f7e1af7489
added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1283 |
"return the errorString passsed with the signal raise |
4562 | 1284 |
(or nil, if there was none). |
1285 |
#errorString is deprecated, use description instead" |
|
4481
f3f7e1af7489
added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1286 |
|
6859
5ef85865e8db
Print exception description with #printOn:
Stefan Vogel <sv@exept.de>
parents:
6630
diff
changeset
|
1287 |
<resource:#obsolete> |
4562 | 1288 |
|
1289 |
^ self description |
|
4481
f3f7e1af7489
added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1290 |
|
f3f7e1af7489
added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1291 |
"Modified: / 12.3.1998 / 15:13:28 / stefan" |
f3f7e1af7489
added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1292 |
! |
f3f7e1af7489
added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1293 |
|
8617 | 1294 |
errorString:aString |
8313
2aa626e8e404
Fix do not execute an exception handler inside the do-block, when the
Stefan Vogel <sv@exept.de>
parents:
8254
diff
changeset
|
1295 |
"set the messageText. |
2aa626e8e404
Fix do not execute an exception handler inside the do-block, when the
Stefan Vogel <sv@exept.de>
parents:
8254
diff
changeset
|
1296 |
If it starts with a space, the signals messageText is prepended, |
4562 | 1297 |
if it ends with a space, it is appended. |
1298 |
#errorString: is deprecated, use messageText: instead" |
|
4481
f3f7e1af7489
added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1299 |
|
6859
5ef85865e8db
Print exception description with #printOn:
Stefan Vogel <sv@exept.de>
parents:
6630
diff
changeset
|
1300 |
<resource:#obsolete> |
5ef85865e8db
Print exception description with #printOn:
Stefan Vogel <sv@exept.de>
parents:
6630
diff
changeset
|
1301 |
|
8313
2aa626e8e404
Fix do not execute an exception handler inside the do-block, when the
Stefan Vogel <sv@exept.de>
parents:
8254
diff
changeset
|
1302 |
messageText := aString |
4481
f3f7e1af7489
added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1303 |
|
f3f7e1af7489
added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1304 |
"Created: / 5.3.1998 / 16:45:29 / stefan" |
f3f7e1af7489
added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1305 |
"Modified: / 12.3.1998 / 15:30:45 / stefan" |
f3f7e1af7489
added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1306 |
! |
f3f7e1af7489
added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1307 |
|
8681
38aa963476a5
Support for Block>>#on:do:on:do:
Stefan Vogel <sv@exept.de>
parents:
8677
diff
changeset
|
1308 |
handler |
38aa963476a5
Support for Block>>#on:do:on:do:
Stefan Vogel <sv@exept.de>
parents:
8677
diff
changeset
|
1309 |
"return the exception handler (Signal or SignalSet or ExceptionHandlerSet or Exception) |
38aa963476a5
Support for Block>>#on:do:on:do:
Stefan Vogel <sv@exept.de>
parents:
8677
diff
changeset
|
1310 |
that handles the exception. |
38aa963476a5
Support for Block>>#on:do:on:do:
Stefan Vogel <sv@exept.de>
parents:
8677
diff
changeset
|
1311 |
This is only valid during handler evaluation, and answers |
38aa963476a5
Support for Block>>#on:do:on:do:
Stefan Vogel <sv@exept.de>
parents:
8677
diff
changeset
|
1312 |
the object which accepted the actual exception." |
38aa963476a5
Support for Block>>#on:do:on:do:
Stefan Vogel <sv@exept.de>
parents:
8677
diff
changeset
|
1313 |
|
38aa963476a5
Support for Block>>#on:do:on:do:
Stefan Vogel <sv@exept.de>
parents:
8677
diff
changeset
|
1314 |
handlerContext isNil ifTrue:[ |
16555 | 1315 |
^ nil. |
8681
38aa963476a5
Support for Block>>#on:do:on:do:
Stefan Vogel <sv@exept.de>
parents:
8677
diff
changeset
|
1316 |
]. |
38aa963476a5
Support for Block>>#on:do:on:do:
Stefan Vogel <sv@exept.de>
parents:
8677
diff
changeset
|
1317 |
^ handlerContext receiver exceptionHandlerFor:self in:handlerContext. |
38aa963476a5
Support for Block>>#on:do:on:do:
Stefan Vogel <sv@exept.de>
parents:
8677
diff
changeset
|
1318 |
|
38aa963476a5
Support for Block>>#on:do:on:do:
Stefan Vogel <sv@exept.de>
parents:
8677
diff
changeset
|
1319 |
" |
38aa963476a5
Support for Block>>#on:do:on:do:
Stefan Vogel <sv@exept.de>
parents:
8677
diff
changeset
|
1320 |
[ |
16555 | 1321 |
2 // 0 |
8681
38aa963476a5
Support for Block>>#on:do:on:do:
Stefan Vogel <sv@exept.de>
parents:
8677
diff
changeset
|
1322 |
] on:Error do:[:ex| ex handler inspect] |
38aa963476a5
Support for Block>>#on:do:on:do:
Stefan Vogel <sv@exept.de>
parents:
8677
diff
changeset
|
1323 |
|
38aa963476a5
Support for Block>>#on:do:on:do:
Stefan Vogel <sv@exept.de>
parents:
8677
diff
changeset
|
1324 |
[ |
16555 | 1325 |
2 // 0 |
8681
38aa963476a5
Support for Block>>#on:do:on:do:
Stefan Vogel <sv@exept.de>
parents:
8677
diff
changeset
|
1326 |
] on:ArithmeticError, Error do:[:ex| ex handler inspect] |
38aa963476a5
Support for Block>>#on:do:on:do:
Stefan Vogel <sv@exept.de>
parents:
8677
diff
changeset
|
1327 |
|
38aa963476a5
Support for Block>>#on:do:on:do:
Stefan Vogel <sv@exept.de>
parents:
8677
diff
changeset
|
1328 |
[ |
16555 | 1329 |
2 // 0 |
8681
38aa963476a5
Support for Block>>#on:do:on:do:
Stefan Vogel <sv@exept.de>
parents:
8677
diff
changeset
|
1330 |
] on:MessageNotUnderstood do:[:ex| ex handler inspect] |
16555 | 1331 |
on:Error do:[:ex| ex handler inspect] |
8681
38aa963476a5
Support for Block>>#on:do:on:do:
Stefan Vogel <sv@exept.de>
parents:
8677
diff
changeset
|
1332 |
" |
38aa963476a5
Support for Block>>#on:do:on:do:
Stefan Vogel <sv@exept.de>
parents:
8677
diff
changeset
|
1333 |
! |
38aa963476a5
Support for Block>>#on:do:on:do:
Stefan Vogel <sv@exept.de>
parents:
8677
diff
changeset
|
1334 |
|
4481
f3f7e1af7489
added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1335 |
handlerContext |
f3f7e1af7489
added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1336 |
"return the context of the handler" |
f3f7e1af7489
added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1337 |
|
f3f7e1af7489
added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1338 |
^ handlerContext |
f3f7e1af7489
added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1339 |
! |
f3f7e1af7489
added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1340 |
|
4483 | 1341 |
handlingException |
8681
38aa963476a5
Support for Block>>#on:do:on:do:
Stefan Vogel <sv@exept.de>
parents:
8677
diff
changeset
|
1342 |
<resource: #obsolete> |
38aa963476a5
Support for Block>>#on:do:on:do:
Stefan Vogel <sv@exept.de>
parents:
8677
diff
changeset
|
1343 |
^ self handler |
4481
f3f7e1af7489
added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1344 |
! |
f3f7e1af7489
added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1345 |
|
4484
9476c82921d0
eliminated proceedBlock and rejectBlock;
Claus Gittinger <cg@exept.de>
parents:
4483
diff
changeset
|
1346 |
isResumable |
9476c82921d0
eliminated proceedBlock and rejectBlock;
Claus Gittinger <cg@exept.de>
parents:
4483
diff
changeset
|
1347 |
"return true, if the exception is resumable" |
9476c82921d0
eliminated proceedBlock and rejectBlock;
Claus Gittinger <cg@exept.de>
parents:
4483
diff
changeset
|
1348 |
|
16248 | 1349 |
^ self mayProceed |
4484
9476c82921d0
eliminated proceedBlock and rejectBlock;
Claus Gittinger <cg@exept.de>
parents:
4483
diff
changeset
|
1350 |
|
9476c82921d0
eliminated proceedBlock and rejectBlock;
Claus Gittinger <cg@exept.de>
parents:
4483
diff
changeset
|
1351 |
"Modified: / 2.3.1998 / 12:20:43 / stefan" |
9476c82921d0
eliminated proceedBlock and rejectBlock;
Claus Gittinger <cg@exept.de>
parents:
4483
diff
changeset
|
1352 |
! |
9476c82921d0
eliminated proceedBlock and rejectBlock;
Claus Gittinger <cg@exept.de>
parents:
4483
diff
changeset
|
1353 |
|
7597 | 1354 |
isResumable:aBoolean |
1355 |
proceedable := aBoolean |
|
1356 |
! |
|
1357 |
||
5950 | 1358 |
messageText |
7808 | 1359 |
"return the explicit given messageText - nil, if signaler did not provide one." |
5950 | 1360 |
|
8313
2aa626e8e404
Fix do not execute an exception handler inside the do-block, when the
Stefan Vogel <sv@exept.de>
parents:
8254
diff
changeset
|
1361 |
^ messageText |
5950 | 1362 |
! |
1363 |
||
8617 | 1364 |
messageText:aString |
4562 | 1365 |
"set the messageText. |
15584 | 1366 |
If it starts with a space, the signal's original messageText is prepended, |
4562 | 1367 |
if it ends with a space, it is appended." |
1368 |
||
8313
2aa626e8e404
Fix do not execute an exception handler inside the do-block, when the
Stefan Vogel <sv@exept.de>
parents:
8254
diff
changeset
|
1369 |
messageText := aString |
4562 | 1370 |
|
15584 | 1371 |
"Created: / 05-03-1998 / 16:45:29 / stefan" |
1372 |
"Modified: / 12-03-1998 / 15:30:45 / stefan" |
|
1373 |
"Modified (comment): / 30-07-2013 / 21:04:43 / cg" |
|
4562 | 1374 |
! |
1375 |
||
14962 | 1376 |
originalSignal |
1377 |
"return the signal/exception which was originally raised. |
|
20417 | 1378 |
For noHandler, that is my unhandled signal; for others, that's the exception itself." |
14962 | 1379 |
|
1380 |
^ self. |
|
1381 |
! |
|
1382 |
||
8617 | 1383 |
originator |
4481
f3f7e1af7489
added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1384 |
"return the originator passsed with the signal raise |
f3f7e1af7489
added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1385 |
(or nil, if there was none)" |
f3f7e1af7489
added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1386 |
|
f3f7e1af7489
added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1387 |
^ originator |
f3f7e1af7489
added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1388 |
! |
f3f7e1af7489
added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1389 |
|
8617 | 1390 |
originator:anObject |
4481
f3f7e1af7489
added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1391 |
"set the originator" |
f3f7e1af7489
added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1392 |
|
f3f7e1af7489
added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1393 |
originator := anObject |
f3f7e1af7489
added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1394 |
|
f3f7e1af7489
added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1395 |
"Created: / 5.3.1998 / 16:34:56 / stefan" |
f3f7e1af7489
added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1396 |
! |
f3f7e1af7489
added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1397 |
|
f3f7e1af7489
added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1398 |
parameter |
f3f7e1af7489
added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1399 |
"return the parameter passsed with the signal raise |
f3f7e1af7489
added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1400 |
(or nil, if there was none)" |
f3f7e1af7489
added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1401 |
|
f3f7e1af7489
added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1402 |
^ parameter |
f3f7e1af7489
added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1403 |
! |
f3f7e1af7489
added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1404 |
|
f3f7e1af7489
added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1405 |
parameter:anObject |
f3f7e1af7489
added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1406 |
"set the parameter of the exception" |
f3f7e1af7489
added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1407 |
|
f3f7e1af7489
added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1408 |
parameter := anObject |
f3f7e1af7489
added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1409 |
|
f3f7e1af7489
added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1410 |
"Created: / 5.3.1998 / 16:34:22 / stefan" |
f3f7e1af7489
added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1411 |
! |
f3f7e1af7489
added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1412 |
|
6036 | 1413 |
proceedable:aBoolean |
16507 | 1414 |
"explicitly change the proceedability. |
1415 |
Normally this gets initialized from the classes idea of whether this makes sense" |
|
1416 |
||
6036 | 1417 |
proceedable := aBoolean |
1418 |
! |
|
1419 |
||
9992
0774694cf9b3
- Add raiseContext as instance variable for faster #resume
Stefan Vogel <sv@exept.de>
parents:
9505
diff
changeset
|
1420 |
raiseContext |
0774694cf9b3
- Add raiseContext as instance variable for faster #resume
Stefan Vogel <sv@exept.de>
parents:
9505
diff
changeset
|
1421 |
^ raiseContext |
0774694cf9b3
- Add raiseContext as instance variable for faster #resume
Stefan Vogel <sv@exept.de>
parents:
9505
diff
changeset
|
1422 |
! |
0774694cf9b3
- Add raiseContext as instance variable for faster #resume
Stefan Vogel <sv@exept.de>
parents:
9505
diff
changeset
|
1423 |
|
4481
f3f7e1af7489
added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1424 |
rejected |
15681 | 1425 |
"return true, if any other of the exception's handlers has rejected |
4481
f3f7e1af7489
added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1426 |
Uncertain, if this is really interesting to anybody. |
f3f7e1af7489
added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1427 |
This is only valid during handler execution. |
15681 | 1428 |
(i.e. an outer handler can find out, if any other handler has already rejected). |
8617 | 1429 |
Currently only used to change the 'unhandled-exception' messageText |
11234
65c3be6b0d72
got rid of the \"unhandled...(\" prefix in the debugger;
Claus Gittinger <cg@exept.de>
parents:
11026
diff
changeset
|
1430 |
into 'rejected-exception' for the information, that there was a handler which rejected. |
4481
f3f7e1af7489
added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1431 |
" |
f3f7e1af7489
added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1432 |
|
4564 | 1433 |
^ rejected == true |
4481
f3f7e1af7489
added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1434 |
! |
f3f7e1af7489
added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1435 |
|
9992
0774694cf9b3
- Add raiseContext as instance variable for faster #resume
Stefan Vogel <sv@exept.de>
parents:
9505
diff
changeset
|
1436 |
returnableSuspendedContext |
0774694cf9b3
- Add raiseContext as instance variable for faster #resume
Stefan Vogel <sv@exept.de>
parents:
9505
diff
changeset
|
1437 |
"return a nearest returnable context above suspendedContext in the sender chain. |
0774694cf9b3
- Add raiseContext as instance variable for faster #resume
Stefan Vogel <sv@exept.de>
parents:
9505
diff
changeset
|
1438 |
We know, that raiseContext is always returnable, so if suspendedContext |
0774694cf9b3
- Add raiseContext as instance variable for faster #resume
Stefan Vogel <sv@exept.de>
parents:
9505
diff
changeset
|
1439 |
is non-returnable, start there" |
0774694cf9b3
- Add raiseContext as instance variable for faster #resume
Stefan Vogel <sv@exept.de>
parents:
9505
diff
changeset
|
1440 |
|
10389 | 1441 |
|returnableContext nextContext| |
9992
0774694cf9b3
- Add raiseContext as instance variable for faster #resume
Stefan Vogel <sv@exept.de>
parents:
9505
diff
changeset
|
1442 |
|
0774694cf9b3
- Add raiseContext as instance variable for faster #resume
Stefan Vogel <sv@exept.de>
parents:
9505
diff
changeset
|
1443 |
returnableContext := suspendedContext. |
16555 | 1444 |
returnableContext canReturn ifFalse:[ |
20186 | 1445 |
"the context that triggered the exception cannot return. |
1446 |
This is a fallback: return the context of the raise*. |
|
1447 |
We know, that this context is returnable" |
|
1448 |
||
1449 |
returnableContext := nextContext := raiseContext. |
|
1450 |
"find the returnable context that is the nearest in the sender chain |
|
1451 |
to suspendedContext...." |
|
1452 |
[ |
|
1453 |
nextContext := nextContext sender. |
|
1454 |
nextContext isNil ifTrue:[ |
|
1455 |
"suspendedContext appears to not exist on sender chain..." |
|
1456 |
^ raiseContext. |
|
1457 |
]. |
|
1458 |
nextContext canReturn ifTrue:[ |
|
1459 |
returnableContext := nextContext. |
|
1460 |
]. |
|
1461 |
nextContext ~~ suspendedContext. |
|
1462 |
] whileTrue. |
|
9992
0774694cf9b3
- Add raiseContext as instance variable for faster #resume
Stefan Vogel <sv@exept.de>
parents:
9505
diff
changeset
|
1463 |
]. |
0774694cf9b3
- Add raiseContext as instance variable for faster #resume
Stefan Vogel <sv@exept.de>
parents:
9505
diff
changeset
|
1464 |
^ returnableContext |
0774694cf9b3
- Add raiseContext as instance variable for faster #resume
Stefan Vogel <sv@exept.de>
parents:
9505
diff
changeset
|
1465 |
! |
0774694cf9b3
- Add raiseContext as instance variable for faster #resume
Stefan Vogel <sv@exept.de>
parents:
9505
diff
changeset
|
1466 |
|
8617 | 1467 |
searchFrom:raisingContext |
5697
ce78c7d9ddbd
raiseSignal / raiseSignal: / raiseSignal:with:
Claus Gittinger <cg@exept.de>
parents:
5684
diff
changeset
|
1468 |
suspendedContext := raisingContext |
ce78c7d9ddbd
raiseSignal / raiseSignal: / raiseSignal:with:
Claus Gittinger <cg@exept.de>
parents:
5684
diff
changeset
|
1469 |
! |
ce78c7d9ddbd
raiseSignal / raiseSignal: / raiseSignal:with:
Claus Gittinger <cg@exept.de>
parents:
5684
diff
changeset
|
1470 |
|
4481
f3f7e1af7489
added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1471 |
suspendedContext |
20261 | 1472 |
"return the context in which the raise occurred" |
4481
f3f7e1af7489
added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1473 |
|
f3f7e1af7489
added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1474 |
^ suspendedContext |
f3f7e1af7489
added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1475 |
! |
f3f7e1af7489
added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1476 |
|
f3f7e1af7489
added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1477 |
suspendedContext:something |
f3f7e1af7489
added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1478 |
"set the value of the instance variable 'suspendedContext' (automatically generated)" |
f3f7e1af7489
added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1479 |
|
f3f7e1af7489
added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1480 |
suspendedContext := something. |
f3f7e1af7489
added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1481 |
|
f3f7e1af7489
added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1482 |
"Created: / 2.3.1998 / 12:43:20 / stefan" |
f3f7e1af7489
added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1483 |
! |
f3f7e1af7489
added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1484 |
|
f3f7e1af7489
added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1485 |
willProceed |
f3f7e1af7489
added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1486 |
"return true, if the exception is proceedable" |
f3f7e1af7489
added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1487 |
|
4484
9476c82921d0
eliminated proceedBlock and rejectBlock;
Claus Gittinger <cg@exept.de>
parents:
4483
diff
changeset
|
1488 |
^ self isResumable |
4481
f3f7e1af7489
added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1489 |
|
f3f7e1af7489
added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1490 |
"Modified: / 2.3.1998 / 12:20:43 / stefan" |
f3f7e1af7489
added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1491 |
! ! |
f3f7e1af7489
added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1492 |
|
f3f7e1af7489
added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1493 |
!GenericException methodsFor:'copying'! |
f3f7e1af7489
added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1494 |
|
f3f7e1af7489
added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1495 |
postCopy |
f3f7e1af7489
added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1496 |
"set the internal state to nil" |
f3f7e1af7489
added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1497 |
|
9992
0774694cf9b3
- Add raiseContext as instance variable for faster #resume
Stefan Vogel <sv@exept.de>
parents:
9505
diff
changeset
|
1498 |
raiseContext := suspendedContext := handlerContext := rejected := nil |
4481
f3f7e1af7489
added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1499 |
|
f3f7e1af7489
added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1500 |
"Created: / 2.3.1998 / 12:30:06 / stefan" |
8931 | 1501 |
! |
1502 |
||
1503 |
postDeepCopy |
|
1504 |
"set the internal state to nil" |
|
1505 |
||
1506 |
suspendedContext := handlerContext := rejected := nil |
|
1507 |
||
1508 |
"Created: / 2.3.1998 / 12:30:06 / stefan" |
|
4481
f3f7e1af7489
added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1509 |
! ! |
f3f7e1af7489
added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1510 |
|
f3f7e1af7489
added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1511 |
!GenericException methodsFor:'default actions'! |
f3f7e1af7489
added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1512 |
|
4527 | 1513 |
defaultAction |
4484
9476c82921d0
eliminated proceedBlock and rejectBlock;
Claus Gittinger <cg@exept.de>
parents:
4483
diff
changeset
|
1514 |
"perform a action for the exception if it hasn't been catched |
4481
f3f7e1af7489
added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1515 |
We arrive here, if either no handler was found, or none of the |
4484
9476c82921d0
eliminated proceedBlock and rejectBlock;
Claus Gittinger <cg@exept.de>
parents:
4483
diff
changeset
|
1516 |
handlers did a return (i.e. every handler rejected). |
4481
f3f7e1af7489
added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1517 |
|
8617 | 1518 |
The default is to evaluate the signal's handlerBlock or |
4562 | 1519 |
to raise the noHandlerSignal. |
4481
f3f7e1af7489
added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1520 |
Subclasses may redefine this." |
f3f7e1af7489
added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1521 |
|
9992
0774694cf9b3
- Add raiseContext as instance variable for faster #resume
Stefan Vogel <sv@exept.de>
parents:
9505
diff
changeset
|
1522 |
<context: #return> |
0774694cf9b3
- Add raiseContext as instance variable for faster #resume
Stefan Vogel <sv@exept.de>
parents:
9505
diff
changeset
|
1523 |
|
4562 | 1524 |
|handlerBlock| |
4481
f3f7e1af7489
added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1525 |
|
f3f7e1af7489
added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1526 |
" |
f3f7e1af7489
added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1527 |
try per signal handler |
f3f7e1af7489
added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1528 |
" |
15336 | 1529 |
(handlerBlock := self creator handlerBlock) notNil ifTrue:[ |
16555 | 1530 |
"... and call it" |
1531 |
^ handlerBlock value:self. |
|
4481
f3f7e1af7489
added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1532 |
]. |
4484
9476c82921d0
eliminated proceedBlock and rejectBlock;
Claus Gittinger <cg@exept.de>
parents:
4483
diff
changeset
|
1533 |
|
4562 | 1534 |
^ self noHandler. |
4481
f3f7e1af7489
added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1535 |
|
f3f7e1af7489
added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1536 |
"Created: / 23.7.1999 / 14:38:03 / stefan" |
4517
8c539600fb63
Implement NoHandlerException etc. as class based exceptions.
Stefan Vogel <sv@exept.de>
parents:
4513
diff
changeset
|
1537 |
"Modified: / 4.8.1999 / 08:11:05 / stefan" |
4481
f3f7e1af7489
added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1538 |
! |
f3f7e1af7489
added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1539 |
|
f3f7e1af7489
added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1540 |
mayProceed |
f3f7e1af7489
added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1541 |
"return true, if the exception handler is allowed to proceed |
20261 | 1542 |
the execution where the exception occurred. |
4481
f3f7e1af7489
added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1543 |
|
f3f7e1af7489
added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1544 |
Subclasses may redefine this." |
f3f7e1af7489
added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1545 |
|
6920
ff7892b5b41a
no longer raise ProceedError
Claus Gittinger <cg@exept.de>
parents:
6859
diff
changeset
|
1546 |
proceedable notNil ifTrue:[^ proceedable]. |
13009
e068f228a24b
eliminated 1 to 2 message sends when raising
Claus Gittinger <cg@exept.de>
parents:
12940
diff
changeset
|
1547 |
signal notNil ifTrue:[^ signal mayProceed]. |
e068f228a24b
eliminated 1 to 2 message sends when raising
Claus Gittinger <cg@exept.de>
parents:
12940
diff
changeset
|
1548 |
^ self class mayProceed. |
e068f228a24b
eliminated 1 to 2 message sends when raising
Claus Gittinger <cg@exept.de>
parents:
12940
diff
changeset
|
1549 |
|
e068f228a24b
eliminated 1 to 2 message sends when raising
Claus Gittinger <cg@exept.de>
parents:
12940
diff
changeset
|
1550 |
"Created: / 23-07-1999 / 14:48:26 / stefan" |
e068f228a24b
eliminated 1 to 2 message sends when raising
Claus Gittinger <cg@exept.de>
parents:
12940
diff
changeset
|
1551 |
"Modified: / 10-08-2010 / 09:39:15 / cg" |
4562 | 1552 |
! |
1553 |
||
1554 |
noHandler |
|
1555 |
"raise the NoHandlerError. |
|
1556 |
NohandlerError redefines this method to avoid recursive invocations" |
|
1557 |
||
4564 | 1558 |
<context: #return> |
1559 |
||
4562 | 1560 |
|msg| |
1561 |
||
4564 | 1562 |
rejected == true ifTrue:[ |
16555 | 1563 |
msg := 'unhandled (rejected)' |
4562 | 1564 |
] ifFalse:[ |
16555 | 1565 |
msg := 'unhandled' |
4562 | 1566 |
]. |
5295 | 1567 |
msg := msg , ' exception: (' , self description , ')'. |
4564 | 1568 |
self mayProceed ifTrue:[ |
16555 | 1569 |
^ NoHandlerError |
1570 |
raiseRequestWith:self |
|
1571 |
errorString:msg |
|
1572 |
in:suspendedContext. |
|
4564 | 1573 |
]. |
8617 | 1574 |
^ NoHandlerError |
16555 | 1575 |
raiseWith:self |
1576 |
errorString:msg |
|
1577 |
in:suspendedContext. |
|
4481
f3f7e1af7489
added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1578 |
! ! |
f3f7e1af7489
added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1579 |
|
5984
2d5c04c9fab6
ANSI; added #defaultResumeValue and #defaultReturnValue.
Claus Gittinger <cg@exept.de>
parents:
5950
diff
changeset
|
1580 |
!GenericException methodsFor:'default values'! |
2d5c04c9fab6
ANSI; added #defaultResumeValue and #defaultReturnValue.
Claus Gittinger <cg@exept.de>
parents:
5950
diff
changeset
|
1581 |
|
2d5c04c9fab6
ANSI; added #defaultResumeValue and #defaultReturnValue.
Claus Gittinger <cg@exept.de>
parents:
5950
diff
changeset
|
1582 |
defaultResumeValue |
17270 | 1583 |
"the default answer, if no one handles the query and the exception is resumed" |
1584 |
||
5984
2d5c04c9fab6
ANSI; added #defaultResumeValue and #defaultReturnValue.
Claus Gittinger <cg@exept.de>
parents:
5950
diff
changeset
|
1585 |
^ nil |
2d5c04c9fab6
ANSI; added #defaultResumeValue and #defaultReturnValue.
Claus Gittinger <cg@exept.de>
parents:
5950
diff
changeset
|
1586 |
! |
2d5c04c9fab6
ANSI; added #defaultResumeValue and #defaultReturnValue.
Claus Gittinger <cg@exept.de>
parents:
5950
diff
changeset
|
1587 |
|
2d5c04c9fab6
ANSI; added #defaultResumeValue and #defaultReturnValue.
Claus Gittinger <cg@exept.de>
parents:
5950
diff
changeset
|
1588 |
defaultReturnValue |
2d5c04c9fab6
ANSI; added #defaultResumeValue and #defaultReturnValue.
Claus Gittinger <cg@exept.de>
parents:
5950
diff
changeset
|
1589 |
^ nil |
2d5c04c9fab6
ANSI; added #defaultResumeValue and #defaultReturnValue.
Claus Gittinger <cg@exept.de>
parents:
5950
diff
changeset
|
1590 |
! ! |
2d5c04c9fab6
ANSI; added #defaultResumeValue and #defaultReturnValue.
Claus Gittinger <cg@exept.de>
parents:
5950
diff
changeset
|
1591 |
|
4481
f3f7e1af7489
added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1592 |
!GenericException methodsFor:'handler actions'! |
f3f7e1af7489
added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1593 |
|
5985 | 1594 |
exit |
16224 | 1595 |
"either resume or return - depending on the receiver's resumability. |
5985 | 1596 |
VW compatibility." |
1597 |
||
1598 |
self isResumable ifTrue:[ |
|
16555 | 1599 |
self proceedWith:(self defaultResumeValue) |
5985 | 1600 |
] ifFalse:[ |
16555 | 1601 |
self return:(self defaultReturnValue) |
5985 | 1602 |
] |
1603 |
||
1604 |
"Modified: / 7.9.2001 / 13:28:54 / cg" |
|
1605 |
! |
|
1606 |
||
1607 |
exit:value |
|
16224 | 1608 |
"either resume or return - depending on the receiver's resumability. |
5985 | 1609 |
VW compatibility." |
1610 |
||
1611 |
self isResumable ifTrue:[ |
|
16555 | 1612 |
self proceedWith:value |
5985 | 1613 |
] ifFalse:[ |
16555 | 1614 |
self return:value |
5985 | 1615 |
] |
1616 |
||
1617 |
"Created: / 7.9.2001 / 13:29:55 / cg" |
|
1618 |
"Modified: / 7.9.2001 / 13:30:00 / cg" |
|
1619 |
! |
|
1620 |
||
4481
f3f7e1af7489
added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1621 |
proceed |
f3f7e1af7489
added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1622 |
"Continue after the raise - the raise returns nil" |
f3f7e1af7489
added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1623 |
|
5984
2d5c04c9fab6
ANSI; added #defaultResumeValue and #defaultReturnValue.
Claus Gittinger <cg@exept.de>
parents:
5950
diff
changeset
|
1624 |
self proceedWith:(self defaultResumeValue). |
4481
f3f7e1af7489
added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1625 |
|
8617 | 1626 |
"cg: a strange example: |
16555 | 1627 |
there are two caught errors here - can you spot them ? |
4556 | 1628 |
|
9992
0774694cf9b3
- Add raiseContext as instance variable for faster #resume
Stefan Vogel <sv@exept.de>
parents:
9505
diff
changeset
|
1629 |
Error handle:[:ex| |
16555 | 1630 |
'proceeding' printCR. |
1631 |
ex proceed |
|
4484
9476c82921d0
eliminated proceedBlock and rejectBlock;
Claus Gittinger <cg@exept.de>
parents:
4483
diff
changeset
|
1632 |
] do:[ |
16555 | 1633 |
Error raiseRequest |
4484
9476c82921d0
eliminated proceedBlock and rejectBlock;
Claus Gittinger <cg@exept.de>
parents:
4483
diff
changeset
|
1634 |
]. |
4481
f3f7e1af7489
added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1635 |
" |
f3f7e1af7489
added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1636 |
|
4517
8c539600fb63
Implement NoHandlerException etc. as class based exceptions.
Stefan Vogel <sv@exept.de>
parents:
4513
diff
changeset
|
1637 |
"Modified: / 4.8.1999 / 08:42:12 / stefan" |
5985 | 1638 |
"Modified: / 7.9.2001 / 13:29:08 / cg" |
4481
f3f7e1af7489
added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1639 |
! |
f3f7e1af7489
added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1640 |
|
f3f7e1af7489
added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1641 |
proceedWith:value |
f3f7e1af7489
added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1642 |
"Continue after the raise - the raise returns value" |
f3f7e1af7489
added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1643 |
|
9992
0774694cf9b3
- Add raiseContext as instance variable for faster #resume
Stefan Vogel <sv@exept.de>
parents:
9505
diff
changeset
|
1644 |
|con rCon| |
4484
9476c82921d0
eliminated proceedBlock and rejectBlock;
Claus Gittinger <cg@exept.de>
parents:
4483
diff
changeset
|
1645 |
|
15636 | 1646 |
(StrictRaising and:[proceedable not]) ifTrue:[ |
16555 | 1647 |
"proceed from ProceedError to recover from this error" |
1648 |
ProceedError raiseRequestWith:self. |
|
1649 |
proceedable := true. |
|
15636 | 1650 |
]. |
9992
0774694cf9b3
- Add raiseContext as instance variable for faster #resume
Stefan Vogel <sv@exept.de>
parents:
9505
diff
changeset
|
1651 |
|
4556 | 1652 |
thisContext evaluateUnwindActionsUpTo:suspendedContext. |
1653 |
||
9992
0774694cf9b3
- Add raiseContext as instance variable for faster #resume
Stefan Vogel <sv@exept.de>
parents:
9505
diff
changeset
|
1654 |
con := suspendedContext. |
0774694cf9b3
- Add raiseContext as instance variable for faster #resume
Stefan Vogel <sv@exept.de>
parents:
9505
diff
changeset
|
1655 |
rCon := raiseContext. |
0774694cf9b3
- Add raiseContext as instance variable for faster #resume
Stefan Vogel <sv@exept.de>
parents:
9505
diff
changeset
|
1656 |
handlerContext := suspendedContext := raiseContext := nil. |
0774694cf9b3
- Add raiseContext as instance variable for faster #resume
Stefan Vogel <sv@exept.de>
parents:
9505
diff
changeset
|
1657 |
con resumeIgnoringErrors:value. |
4481
f3f7e1af7489
added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1658 |
|
9992
0774694cf9b3
- Add raiseContext as instance variable for faster #resume
Stefan Vogel <sv@exept.de>
parents:
9505
diff
changeset
|
1659 |
"we arrive here, if suspendedContext is not resumable - |
0774694cf9b3
- Add raiseContext as instance variable for faster #resume
Stefan Vogel <sv@exept.de>
parents:
9505
diff
changeset
|
1660 |
resume our raise context ... |
0774694cf9b3
- Add raiseContext as instance variable for faster #resume
Stefan Vogel <sv@exept.de>
parents:
9505
diff
changeset
|
1661 |
... consider this a fallBack kludge, for the case that |
16555 | 1662 |
a raising context is not returnable." |
9992
0774694cf9b3
- Add raiseContext as instance variable for faster #resume
Stefan Vogel <sv@exept.de>
parents:
9505
diff
changeset
|
1663 |
|
0774694cf9b3
- Add raiseContext as instance variable for faster #resume
Stefan Vogel <sv@exept.de>
parents:
9505
diff
changeset
|
1664 |
rCon return:value. |
4481
f3f7e1af7489
added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1665 |
|
f3f7e1af7489
added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1666 |
"Modified: / 27.3.1997 / 16:45:57 / cg" |
4517
8c539600fb63
Implement NoHandlerException etc. as class based exceptions.
Stefan Vogel <sv@exept.de>
parents:
4513
diff
changeset
|
1667 |
"Modified: / 4.8.1999 / 08:42:17 / stefan" |
4481
f3f7e1af7489
added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1668 |
! |
f3f7e1af7489
added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1669 |
|
f3f7e1af7489
added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1670 |
reject |
f3f7e1af7489
added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1671 |
"handler decided not to handle this signal - |
f3f7e1af7489
added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1672 |
system will look for another handler" |
f3f7e1af7489
added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1673 |
|
4484
9476c82921d0
eliminated proceedBlock and rejectBlock;
Claus Gittinger <cg@exept.de>
parents:
4483
diff
changeset
|
1674 |
|con| |
9476c82921d0
eliminated proceedBlock and rejectBlock;
Claus Gittinger <cg@exept.de>
parents:
4483
diff
changeset
|
1675 |
|
9992
0774694cf9b3
- Add raiseContext as instance variable for faster #resume
Stefan Vogel <sv@exept.de>
parents:
9505
diff
changeset
|
1676 |
"find the last doCallXX: context" |
4484
9476c82921d0
eliminated proceedBlock and rejectBlock;
Claus Gittinger <cg@exept.de>
parents:
4483
diff
changeset
|
1677 |
con := Context findFirstSpecialHandle:false raise:true. |
8617 | 1678 |
[con notNil |
4484
9476c82921d0
eliminated proceedBlock and rejectBlock;
Claus Gittinger <cg@exept.de>
parents:
4483
diff
changeset
|
1679 |
and:[con receiver ~~ self]] whileTrue:[ |
16555 | 1680 |
con := con findSpecialHandle:false raise:true. |
4484
9476c82921d0
eliminated proceedBlock and rejectBlock;
Claus Gittinger <cg@exept.de>
parents:
4483
diff
changeset
|
1681 |
]. |
4481
f3f7e1af7489
added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1682 |
|
9992
0774694cf9b3
- Add raiseContext as instance variable for faster #resume
Stefan Vogel <sv@exept.de>
parents:
9505
diff
changeset
|
1683 |
"returning form the doCallXX: signals a reject" |
4481
f3f7e1af7489
added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1684 |
rejected := true. |
4484
9476c82921d0
eliminated proceedBlock and rejectBlock;
Claus Gittinger <cg@exept.de>
parents:
4483
diff
changeset
|
1685 |
con unwind:nil. |
4481
f3f7e1af7489
added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1686 |
|
f3f7e1af7489
added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1687 |
" |
11775 | 1688 |
Error handle:[:ex | |
16555 | 1689 |
'1' printCR. |
1690 |
ex reject |
|
4481
f3f7e1af7489
added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1691 |
] do:[ |
16555 | 1692 |
Error handle:[:ex | |
1693 |
'2' printCR. |
|
1694 |
ex reject |
|
1695 |
] do:[ |
|
1696 |
#() at:1 |
|
1697 |
] |
|
4481
f3f7e1af7489
added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1698 |
] |
f3f7e1af7489
added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1699 |
" |
f3f7e1af7489
added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1700 |
! |
f3f7e1af7489
added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1701 |
|
4556 | 1702 |
resignalAs:anotherException |
1703 |
"resignal anotherException, as if it was raised in the first place" |
|
1704 |
||
1705 |
|con| |
|
1706 |
||
9992
0774694cf9b3
- Add raiseContext as instance variable for faster #resume
Stefan Vogel <sv@exept.de>
parents:
9505
diff
changeset
|
1707 |
con := self returnableSuspendedContext. |
13803
4adfe051c944
Fix the exception handler actions (#return, #restart, ...) to work
Stefan Vogel <sv@exept.de>
parents:
13305
diff
changeset
|
1708 |
thisContext evaluateUnwindActionsUpTo:con. |
9992
0774694cf9b3
- Add raiseContext as instance variable for faster #resume
Stefan Vogel <sv@exept.de>
parents:
9505
diff
changeset
|
1709 |
handlerContext := suspendedContext := raiseContext := nil. |
13803
4adfe051c944
Fix the exception handler actions (#return, #restart, ...) to work
Stefan Vogel <sv@exept.de>
parents:
13305
diff
changeset
|
1710 |
con returnDoing:[anotherException raiseSignal] |
4556 | 1711 |
|
1712 |
" |
|
6364
b7d1a52ec256
Workaround for non-returnable contexts in #resignalAs:
Stefan Vogel <sv@exept.de>
parents:
6264
diff
changeset
|
1713 |
|rslt| |
b7d1a52ec256
Workaround for non-returnable contexts in #resignalAs:
Stefan Vogel <sv@exept.de>
parents:
6264
diff
changeset
|
1714 |
|
7753 | 1715 |
ZeroDivide handle:[:ex | |
16555 | 1716 |
ex resignalAs:DomainError |
6364
b7d1a52ec256
Workaround for non-returnable contexts in #resignalAs:
Stefan Vogel <sv@exept.de>
parents:
6264
diff
changeset
|
1717 |
] do:[ |
16555 | 1718 |
rslt := 5 // 0 |
6364
b7d1a52ec256
Workaround for non-returnable contexts in #resignalAs:
Stefan Vogel <sv@exept.de>
parents:
6264
diff
changeset
|
1719 |
]. |
b7d1a52ec256
Workaround for non-returnable contexts in #resignalAs:
Stefan Vogel <sv@exept.de>
parents:
6264
diff
changeset
|
1720 |
rslt |
b7d1a52ec256
Workaround for non-returnable contexts in #resignalAs:
Stefan Vogel <sv@exept.de>
parents:
6264
diff
changeset
|
1721 |
" |
b7d1a52ec256
Workaround for non-returnable contexts in #resignalAs:
Stefan Vogel <sv@exept.de>
parents:
6264
diff
changeset
|
1722 |
|
b7d1a52ec256
Workaround for non-returnable contexts in #resignalAs:
Stefan Vogel <sv@exept.de>
parents:
6264
diff
changeset
|
1723 |
" |
b7d1a52ec256
Workaround for non-returnable contexts in #resignalAs:
Stefan Vogel <sv@exept.de>
parents:
6264
diff
changeset
|
1724 |
|rslt| |
4556 | 1725 |
|
7753 | 1726 |
MessageNotUnderstood handle:[:ex | |
16555 | 1727 |
ex resignalAs:Number domainErrorSignal |
4556 | 1728 |
] do:[ |
16555 | 1729 |
rslt := 1 perform:#foo |
4556 | 1730 |
]. |
1731 |
rslt |
|
1732 |
" |
|
12156
175e2d1a1652
comment/format in: #resignalAs:
Claus Gittinger <cg@exept.de>
parents:
12085
diff
changeset
|
1733 |
|
175e2d1a1652
comment/format in: #resignalAs:
Claus Gittinger <cg@exept.de>
parents:
12085
diff
changeset
|
1734 |
" |
175e2d1a1652
comment/format in: #resignalAs:
Claus Gittinger <cg@exept.de>
parents:
12085
diff
changeset
|
1735 |
|rslt firstTime| |
175e2d1a1652
comment/format in: #resignalAs:
Claus Gittinger <cg@exept.de>
parents:
12085
diff
changeset
|
1736 |
|
175e2d1a1652
comment/format in: #resignalAs:
Claus Gittinger <cg@exept.de>
parents:
12085
diff
changeset
|
1737 |
firstTime := true. |
175e2d1a1652
comment/format in: #resignalAs:
Claus Gittinger <cg@exept.de>
parents:
12085
diff
changeset
|
1738 |
ZeroDivide handle:[:ex | |
16555 | 1739 |
firstTime ifTrue:[ |
1740 |
Dialog information:'again...'. |
|
1741 |
firstTime := false. |
|
1742 |
ex resignalAs:ZeroDivide. |
|
1743 |
]. |
|
1744 |
Dialog information:'arrived here again...'. |
|
12156
175e2d1a1652
comment/format in: #resignalAs:
Claus Gittinger <cg@exept.de>
parents:
12085
diff
changeset
|
1745 |
] do:[ |
16555 | 1746 |
rslt := 5 // 0 |
12156
175e2d1a1652
comment/format in: #resignalAs:
Claus Gittinger <cg@exept.de>
parents:
12085
diff
changeset
|
1747 |
]. |
175e2d1a1652
comment/format in: #resignalAs:
Claus Gittinger <cg@exept.de>
parents:
12085
diff
changeset
|
1748 |
rslt |
175e2d1a1652
comment/format in: #resignalAs:
Claus Gittinger <cg@exept.de>
parents:
12085
diff
changeset
|
1749 |
" |
4556 | 1750 |
! |
1751 |
||
4481
f3f7e1af7489
added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1752 |
restart |
f3f7e1af7489
added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1753 |
"restart the handle:do: - usually after some repair work is done |
f3f7e1af7489
added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1754 |
in the handler" |
f3f7e1af7489
added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1755 |
|
4484
9476c82921d0
eliminated proceedBlock and rejectBlock;
Claus Gittinger <cg@exept.de>
parents:
4483
diff
changeset
|
1756 |
|con| |
9476c82921d0
eliminated proceedBlock and rejectBlock;
Claus Gittinger <cg@exept.de>
parents:
4483
diff
changeset
|
1757 |
|
9476c82921d0
eliminated proceedBlock and rejectBlock;
Claus Gittinger <cg@exept.de>
parents:
4483
diff
changeset
|
1758 |
con := handlerContext. |
9992
0774694cf9b3
- Add raiseContext as instance variable for faster #resume
Stefan Vogel <sv@exept.de>
parents:
9505
diff
changeset
|
1759 |
handlerContext := suspendedContext := raiseContext := nil. |
15321 | 1760 |
con unwindAndRestart. |
1761 |
||
1762 |
"/ thisContext evaluateUnwindActionsUpTo:con. |
|
1763 |
"/ handlerContext := suspendedContext := raiseContext := nil. |
|
1764 |
"/ con restart |
|
4481
f3f7e1af7489
added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1765 |
|
f3f7e1af7489
added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1766 |
" |
f3f7e1af7489
added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1767 |
|rslt n| |
f3f7e1af7489
added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1768 |
|
9992
0774694cf9b3
- Add raiseContext as instance variable for faster #resume
Stefan Vogel <sv@exept.de>
parents:
9505
diff
changeset
|
1769 |
Error handle:[:ex | |
16555 | 1770 |
Transcript showCR:'fixing divisor ...'. |
1771 |
n := 1. |
|
1772 |
ex restart. |
|
4481
f3f7e1af7489
added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1773 |
] do:[ |
16555 | 1774 |
rslt := 5 / n. |
4481
f3f7e1af7489
added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1775 |
]. |
f3f7e1af7489
added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1776 |
rslt |
f3f7e1af7489
added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1777 |
" |
f3f7e1af7489
added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1778 |
! |
f3f7e1af7489
added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1779 |
|
f3f7e1af7489
added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1780 |
restartDo:aBlock |
f3f7e1af7489
added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1781 |
"restart the handle:do: but execute the argument, aBlock instead of the |
f3f7e1af7489
added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1782 |
original do-block - usually after some repair work is done in handler" |
f3f7e1af7489
added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1783 |
|
4484
9476c82921d0
eliminated proceedBlock and rejectBlock;
Claus Gittinger <cg@exept.de>
parents:
4483
diff
changeset
|
1784 |
|con| |
9476c82921d0
eliminated proceedBlock and rejectBlock;
Claus Gittinger <cg@exept.de>
parents:
4483
diff
changeset
|
1785 |
|
9476c82921d0
eliminated proceedBlock and rejectBlock;
Claus Gittinger <cg@exept.de>
parents:
4483
diff
changeset
|
1786 |
con := handlerContext. |
9476c82921d0
eliminated proceedBlock and rejectBlock;
Claus Gittinger <cg@exept.de>
parents:
4483
diff
changeset
|
1787 |
|
4481
f3f7e1af7489
added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1788 |
"/ handlerContext unwindThenDo:[ |
8617 | 1789 |
"/ handlerContext receiver |
4481
f3f7e1af7489
added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1790 |
"/ handle:(handlerContext argAt:1) |
f3f7e1af7489
added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1791 |
"/ do:aBlock |
f3f7e1af7489
added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1792 |
"/ ]. |
13803
4adfe051c944
Fix the exception handler actions (#return, #restart, ...) to work
Stefan Vogel <sv@exept.de>
parents:
13305
diff
changeset
|
1793 |
|
4544
2a0e3853d320
#returnDoing works for any exception handler.
Stefan Vogel <sv@exept.de>
parents:
4538
diff
changeset
|
1794 |
con receiver handlerProtectedBlock:aBlock inContext:con. |
15321 | 1795 |
"/ thisContext evaluateUnwindActionsUpTo:con. |
1796 |
"/ handlerContext := suspendedContext := raiseContext := nil. |
|
1797 |
"/ con restart |
|
13803
4adfe051c944
Fix the exception handler actions (#return, #restart, ...) to work
Stefan Vogel <sv@exept.de>
parents:
13305
diff
changeset
|
1798 |
handlerContext := suspendedContext := raiseContext := nil. |
15321 | 1799 |
con unwindAndRestart. |
4481
f3f7e1af7489
added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1800 |
|
f3f7e1af7489
added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1801 |
" |
f3f7e1af7489
added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1802 |
|sig rslt| |
f3f7e1af7489
added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1803 |
|
f3f7e1af7489
added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1804 |
sig := Signal new. |
f3f7e1af7489
added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1805 |
|
f3f7e1af7489
added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1806 |
sig handle:[:ex | |
16555 | 1807 |
Transcript showCR:'exchanging do-block ...'. |
1808 |
ex restartDo:[ rslt := 999 ] |
|
4481
f3f7e1af7489
added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1809 |
] do:[ |
16555 | 1810 |
rslt := 0. |
1811 |
sig raise |
|
4481
f3f7e1af7489
added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1812 |
]. |
f3f7e1af7489
added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1813 |
Transcript showCR:rslt |
f3f7e1af7489
added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1814 |
" |
f3f7e1af7489
added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1815 |
|
f3f7e1af7489
added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1816 |
" |
f3f7e1af7489
added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1817 |
|sig rslt| |
f3f7e1af7489
added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1818 |
|
f3f7e1af7489
added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1819 |
Object errorSignal handle:[:ex | |
16555 | 1820 |
ex restartDo:[ rslt := 999 ] |
4481
f3f7e1af7489
added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1821 |
] do:[ |
16555 | 1822 |
rslt := nil foo. |
4481
f3f7e1af7489
added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1823 |
|
f3f7e1af7489
added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1824 |
]. |
f3f7e1af7489
added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1825 |
Transcript showCR:rslt |
f3f7e1af7489
added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1826 |
" |
f3f7e1af7489
added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1827 |
|
f3f7e1af7489
added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1828 |
" |
f3f7e1af7489
added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1829 |
|sig rslt| |
f3f7e1af7489
added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1830 |
|
f3f7e1af7489
added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1831 |
Object errorSignal handle:[:ex | |
16555 | 1832 |
ex restartDo:[ 'handler' printCR. rslt := nil foo ] |
4481
f3f7e1af7489
added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1833 |
] do:[ |
16555 | 1834 |
rslt := nil foo. |
4481
f3f7e1af7489
added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1835 |
|
f3f7e1af7489
added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1836 |
]. |
f3f7e1af7489
added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1837 |
Transcript showCR:rslt |
f3f7e1af7489
added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1838 |
" |
f3f7e1af7489
added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1839 |
|
f3f7e1af7489
added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1840 |
"Modified: / 8.11.1997 / 18:52:28 / cg" |
f3f7e1af7489
added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1841 |
! |
f3f7e1af7489
added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1842 |
|
f3f7e1af7489
added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1843 |
resume |
11299 | 1844 |
"Continue after the raise - the raise returns defaultResumeValue - ANSI" |
1845 |
||
1846 |
self proceedWith:(self defaultResumeValue) |
|
4481
f3f7e1af7489
added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1847 |
|
f3f7e1af7489
added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1848 |
"Modified: / 2.3.1998 / 10:51:55 / stefan" |
5985 | 1849 |
"Modified: / 7.9.2001 / 13:28:34 / cg" |
1850 |
! |
|
1851 |
||
1852 |
resume:value |
|
9992
0774694cf9b3
- Add raiseContext as instance variable for faster #resume
Stefan Vogel <sv@exept.de>
parents:
9505
diff
changeset
|
1853 |
"Continue after the raise - the raise returns value - ANSI" |
5985 | 1854 |
|
11299 | 1855 |
self proceedWith:value |
5985 | 1856 |
|
1857 |
"Modified: / 7.9.2001 / 13:28:49 / cg" |
|
4481
f3f7e1af7489
added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1858 |
! |
f3f7e1af7489
added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1859 |
|
f3f7e1af7489
added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1860 |
resumeWith:value |
9992
0774694cf9b3
- Add raiseContext as instance variable for faster #resume
Stefan Vogel <sv@exept.de>
parents:
9505
diff
changeset
|
1861 |
"Continue after the raise - the raise returns value - ANSI" |
8617 | 1862 |
|
11299 | 1863 |
self proceedWith:value |
4481
f3f7e1af7489
added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1864 |
|
f3f7e1af7489
added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1865 |
"Modified: / 2.3.1998 / 10:51:48 / stefan" |
5985 | 1866 |
"Modified: / 7.9.2001 / 13:29:26 / cg" |
4481
f3f7e1af7489
added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1867 |
! |
f3f7e1af7489
added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1868 |
|
f3f7e1af7489
added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1869 |
return |
f3f7e1af7489
added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1870 |
"Continue after the handle:do: - the handle:do: returns nil" |
f3f7e1af7489
added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1871 |
|
15321 | 1872 |
|con value| |
4481
f3f7e1af7489
added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1873 |
|
f3f7e1af7489
added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1874 |
con := handlerContext. |
15261 | 1875 |
"/ cg: moving the following clearing of the handlerContext |
1876 |
"/ to before the evalUnwindActions allows for the exception |
|
1877 |
"/ to be handled during the unwind. |
|
1878 |
"/ It can be discussed, whether this is correct or not; |
|
1879 |
"/ I think, that the unwind actions should behave just the same as |
|
1880 |
"/ when a normal return is done. As unwind actions are called, |
|
1881 |
"/ these are unmarkedForUnwind anyway, so there should be no danger |
|
1882 |
"/ for endless recursion here... (i.e. each unwind action can at most |
|
1883 |
"/ reraise that exception once). |
|
15321 | 1884 |
value := self defaultReturnValue. "/ evaluate before unwinding |
15261 | 1885 |
handlerContext := suspendedContext := raiseContext := nil. |
13803
4adfe051c944
Fix the exception handler actions (#return, #restart, ...) to work
Stefan Vogel <sv@exept.de>
parents:
13305
diff
changeset
|
1886 |
thisContext evaluateUnwindActionsUpTo:con. |
15261 | 1887 |
"/ handlerContext := suspendedContext := raiseContext := nil. |
15321 | 1888 |
con return:value |
4481
f3f7e1af7489
added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1889 |
|
5985 | 1890 |
"Modified: / 7.9.2001 / 13:29:34 / cg" |
4481
f3f7e1af7489
added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1891 |
! |
f3f7e1af7489
added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1892 |
|
5939 | 1893 |
return:value |
1894 |
"Continue after the handle:do: - the handle:do: returns value" |
|
1895 |
||
1896 |
|con| |
|
1897 |
||
1898 |
con := handlerContext. |
|
15261 | 1899 |
"/ cg: moving the following clearing of the handlerContext |
1900 |
"/ to before the evalUnwindActions allows for the exception |
|
1901 |
"/ to be handled during the unwind. |
|
1902 |
"/ It can be discussed, whether this is correct or not; |
|
1903 |
"/ I think, that the unwind actions should behave just the same as |
|
1904 |
"/ when a normal return is done. As unwind actions are called, |
|
1905 |
"/ these are unmarkedForUnwind anyway, so there should be no danger |
|
1906 |
"/ for endless recursion here... (i.e. each unwind action can at most |
|
1907 |
"/ reraise that exception once). |
|
1908 |
handlerContext := suspendedContext := raiseContext := nil. |
|
13803
4adfe051c944
Fix the exception handler actions (#return, #restart, ...) to work
Stefan Vogel <sv@exept.de>
parents:
13305
diff
changeset
|
1909 |
thisContext evaluateUnwindActionsUpTo:con. |
15261 | 1910 |
"/ handlerContext := suspendedContext := raiseContext := nil. |
13803
4adfe051c944
Fix the exception handler actions (#return, #restart, ...) to work
Stefan Vogel <sv@exept.de>
parents:
13305
diff
changeset
|
1911 |
con return:value. |
5939 | 1912 |
|
1913 |
"Modified: 27.3.1997 / 16:46:51 / cg" |
|
1914 |
! |
|
1915 |
||
4481
f3f7e1af7489
added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1916 |
returnDoing:aBlock |
4544
2a0e3853d320
#returnDoing works for any exception handler.
Stefan Vogel <sv@exept.de>
parents:
4538
diff
changeset
|
1917 |
"Continue after the handle:do: - the handle:do: returns aBlock value |
2a0e3853d320
#returnDoing works for any exception handler.
Stefan Vogel <sv@exept.de>
parents:
4538
diff
changeset
|
1918 |
Be careful when debugging. You cannot see the context with #returnDoing: |
2a0e3853d320
#returnDoing works for any exception handler.
Stefan Vogel <sv@exept.de>
parents:
4538
diff
changeset
|
1919 |
in the debugger if aBlock raises a signal" |
4481
f3f7e1af7489
added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1920 |
|
4484
9476c82921d0
eliminated proceedBlock and rejectBlock;
Claus Gittinger <cg@exept.de>
parents:
4483
diff
changeset
|
1921 |
|con| |
9476c82921d0
eliminated proceedBlock and rejectBlock;
Claus Gittinger <cg@exept.de>
parents:
4483
diff
changeset
|
1922 |
|
9476c82921d0
eliminated proceedBlock and rejectBlock;
Claus Gittinger <cg@exept.de>
parents:
4483
diff
changeset
|
1923 |
con := handlerContext. |
15261 | 1924 |
"/ cg: moving the following clearing of the handlerContext |
1925 |
"/ to before the evalUnwindActions allows for the exception |
|
1926 |
"/ to be handled during the unwind. |
|
1927 |
"/ It can be discussed, whether this is correct or not; |
|
1928 |
"/ I think, that the unwind actions should behave just the same as |
|
1929 |
"/ when a normal return is done. As unwind actions are called, |
|
1930 |
"/ these are unmarkedForUnwind anyway, so there should be no danger |
|
1931 |
"/ for endless recursion here... (i.e. each unwind action can at most |
|
1932 |
"/ reraise that exception once). |
|
1933 |
handlerContext := suspendedContext := raiseContext := nil. |
|
13803
4adfe051c944
Fix the exception handler actions (#return, #restart, ...) to work
Stefan Vogel <sv@exept.de>
parents:
13305
diff
changeset
|
1934 |
thisContext evaluateUnwindActionsUpTo:con. |
15261 | 1935 |
"/ handlerContext := suspendedContext := raiseContext := nil. |
13803
4adfe051c944
Fix the exception handler actions (#return, #restart, ...) to work
Stefan Vogel <sv@exept.de>
parents:
13305
diff
changeset
|
1936 |
con returnDoing:aBlock |
9992
0774694cf9b3
- Add raiseContext as instance variable for faster #resume
Stefan Vogel <sv@exept.de>
parents:
9505
diff
changeset
|
1937 |
|
0774694cf9b3
- Add raiseContext as instance variable for faster #resume
Stefan Vogel <sv@exept.de>
parents:
9505
diff
changeset
|
1938 |
" |
16555 | 1939 |
[ |
1940 |
5 // 0 |
|
1941 |
] on:Error do:[:ex| |
|
1942 |
ex returnDoing:[self halt. 47*11]. |
|
1943 |
] |
|
9992
0774694cf9b3
- Add raiseContext as instance variable for faster #resume
Stefan Vogel <sv@exept.de>
parents:
9505
diff
changeset
|
1944 |
" |
4481
f3f7e1af7489
added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1945 |
! |
f3f7e1af7489
added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1946 |
|
f3f7e1af7489
added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1947 |
returnWith:value |
f3f7e1af7489
added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1948 |
"Continue after the handle:do: - the handle:do: returns value" |
f3f7e1af7489
added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1949 |
|
5939 | 1950 |
self return:value |
4481
f3f7e1af7489
added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1951 |
! ! |
f3f7e1af7489
added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1952 |
|
5570 | 1953 |
!GenericException methodsFor:'printing & storing'! |
4562 | 1954 |
|
1955 |
description |
|
1956 |
"return the description string of the signal" |
|
1957 |
||
6248
1898c39ebdfa
care for non-string description
Claus Gittinger <cg@exept.de>
parents:
6246
diff
changeset
|
1958 |
|sigDescr| |
1898c39ebdfa
care for non-string description
Claus Gittinger <cg@exept.de>
parents:
6246
diff
changeset
|
1959 |
|
15336 | 1960 |
sigDescr := self creator description. |
1961 |
(messageText isNil or:[messageText isString not]) |
|
6248
1898c39ebdfa
care for non-string description
Claus Gittinger <cg@exept.de>
parents:
6246
diff
changeset
|
1962 |
ifTrue:[ |
16555 | 1963 |
^ sigDescr |
4562 | 1964 |
]. |
8313
2aa626e8e404
Fix do not execute an exception handler inside the do-block, when the
Stefan Vogel <sv@exept.de>
parents:
8254
diff
changeset
|
1965 |
(messageText startsWith:Character space) ifTrue:[ |
16555 | 1966 |
^ sigDescr, messageText. |
4562 | 1967 |
]. |
8313
2aa626e8e404
Fix do not execute an exception handler inside the do-block, when the
Stefan Vogel <sv@exept.de>
parents:
8254
diff
changeset
|
1968 |
(messageText endsWith:Character space) ifTrue:[ |
16555 | 1969 |
^ messageText, sigDescr. |
4562 | 1970 |
]. |
1971 |
||
8313
2aa626e8e404
Fix do not execute an exception handler inside the do-block, when the
Stefan Vogel <sv@exept.de>
parents:
8254
diff
changeset
|
1972 |
^ messageText |
4562 | 1973 |
|
1974 |
" |
|
1975 |
(Error new messageText:'bla') description |
|
1976 |
(Error new messageText:' bla') description |
|
1977 |
(Error new messageText:'bla ') description |
|
1978 |
" |
|
1979 |
||
1980 |
"Modified: / 12.3.1998 / 15:13:28 / stefan" |
|
6859
5ef85865e8db
Print exception description with #printOn:
Stefan Vogel <sv@exept.de>
parents:
6630
diff
changeset
|
1981 |
! |
5ef85865e8db
Print exception description with #printOn:
Stefan Vogel <sv@exept.de>
parents:
6630
diff
changeset
|
1982 |
|
11234
65c3be6b0d72
got rid of the \"unhandled...(\" prefix in the debugger;
Claus Gittinger <cg@exept.de>
parents:
11026
diff
changeset
|
1983 |
descriptionForDebugger |
16555 | 1984 |
"return the description string of the signal which is used in the |
11234
65c3be6b0d72
got rid of the \"unhandled...(\" prefix in the debugger;
Claus Gittinger <cg@exept.de>
parents:
11026
diff
changeset
|
1985 |
debugger title area" |
65c3be6b0d72
got rid of the \"unhandled...(\" prefix in the debugger;
Claus Gittinger <cg@exept.de>
parents:
11026
diff
changeset
|
1986 |
|
65c3be6b0d72
got rid of the \"unhandled...(\" prefix in the debugger;
Claus Gittinger <cg@exept.de>
parents:
11026
diff
changeset
|
1987 |
^ self description. |
65c3be6b0d72
got rid of the \"unhandled...(\" prefix in the debugger;
Claus Gittinger <cg@exept.de>
parents:
11026
diff
changeset
|
1988 |
! |
65c3be6b0d72
got rid of the \"unhandled...(\" prefix in the debugger;
Claus Gittinger <cg@exept.de>
parents:
11026
diff
changeset
|
1989 |
|
6859
5ef85865e8db
Print exception description with #printOn:
Stefan Vogel <sv@exept.de>
parents:
6630
diff
changeset
|
1990 |
printOn:aStream |
8941
4b4c238d0e7b
#printOn: and #printString now print the description (without "an Error())
Stefan Vogel <sv@exept.de>
parents:
8931
diff
changeset
|
1991 |
aStream nextPutAll:self description |
4562 | 1992 |
! ! |
1993 |
||
4481
f3f7e1af7489
added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1994 |
!GenericException methodsFor:'private'! |
f3f7e1af7489
added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1995 |
|
13009
e068f228a24b
eliminated 1 to 2 message sends when raising
Claus Gittinger <cg@exept.de>
parents:
12940
diff
changeset
|
1996 |
checkProceedable |
e068f228a24b
eliminated 1 to 2 message sends when raising
Claus Gittinger <cg@exept.de>
parents:
12940
diff
changeset
|
1997 |
"helper for all raiseRequest methods" |
e068f228a24b
eliminated 1 to 2 message sends when raising
Claus Gittinger <cg@exept.de>
parents:
12940
diff
changeset
|
1998 |
|
e068f228a24b
eliminated 1 to 2 message sends when raising
Claus Gittinger <cg@exept.de>
parents:
12940
diff
changeset
|
1999 |
self mayProceed ifFalse:[ |
16555 | 2000 |
StrictRaising ifTrue:[ |
2001 |
"/ proceeding from wrongProceedabilitySignal grants the raiseRequest |
|
2002 |
WrongProceedabilityError raiseRequestWith:self creator. |
|
2003 |
] ifFalse:[ |
|
2004 |
self class name infoPrint. |
|
2005 |
' [warning]: raised with wrong proceedability' infoPrintCR. |
|
2006 |
] |
|
13009
e068f228a24b
eliminated 1 to 2 message sends when raising
Claus Gittinger <cg@exept.de>
parents:
12940
diff
changeset
|
2007 |
]. |
e068f228a24b
eliminated 1 to 2 message sends when raising
Claus Gittinger <cg@exept.de>
parents:
12940
diff
changeset
|
2008 |
|
e068f228a24b
eliminated 1 to 2 message sends when raising
Claus Gittinger <cg@exept.de>
parents:
12940
diff
changeset
|
2009 |
"Created: / 10-08-2010 / 09:54:41 / cg" |
e068f228a24b
eliminated 1 to 2 message sends when raising
Claus Gittinger <cg@exept.de>
parents:
12940
diff
changeset
|
2010 |
! |
e068f228a24b
eliminated 1 to 2 message sends when raising
Claus Gittinger <cg@exept.de>
parents:
12940
diff
changeset
|
2011 |
|
4484
9476c82921d0
eliminated proceedBlock and rejectBlock;
Claus Gittinger <cg@exept.de>
parents:
4483
diff
changeset
|
2012 |
doCallAction |
8617 | 2013 |
"call the action proper |
4484
9476c82921d0
eliminated proceedBlock and rejectBlock;
Claus Gittinger <cg@exept.de>
parents:
4483
diff
changeset
|
2014 |
- needed an extra method to have a raise-marked context around |
16555 | 2015 |
i.e. do not inline this into #doRaise !! |
15669 | 2016 |
(see implementation of #reject and #proceed)." |
4484
9476c82921d0
eliminated proceedBlock and rejectBlock;
Claus Gittinger <cg@exept.de>
parents:
4483
diff
changeset
|
2017 |
|
4488
db914d752859
must mark returned contexts as returnable
Claus Gittinger <cg@exept.de>
parents:
4484
diff
changeset
|
2018 |
<context: #return> |
db914d752859
must mark returned contexts as returnable
Claus Gittinger <cg@exept.de>
parents:
4484
diff
changeset
|
2019 |
<exception: #raise> |
db914d752859
must mark returned contexts as returnable
Claus Gittinger <cg@exept.de>
parents:
4484
diff
changeset
|
2020 |
|
4527 | 2021 |
^ self defaultAction |
4484
9476c82921d0
eliminated proceedBlock and rejectBlock;
Claus Gittinger <cg@exept.de>
parents:
4483
diff
changeset
|
2022 |
! |
9476c82921d0
eliminated proceedBlock and rejectBlock;
Claus Gittinger <cg@exept.de>
parents:
4483
diff
changeset
|
2023 |
|
4481
f3f7e1af7489
added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2024 |
doCallHandler:aHandlerBlock |
15692 | 2025 |
"call the handler proper - if the handler falls through, return the handler's value |
8691
8b83b6cb00ac
Use #argumentCount instead of #numArgs in #doCallHandler: - it is implemented in Object
Stefan Vogel <sv@exept.de>
parents:
8684
diff
changeset
|
2026 |
- an extra method is needed to have a raise-marked context around. |
16555 | 2027 |
i.e. do not inline this into #doRaise !! |
15669 | 2028 |
(see implementation of #reject and #proceed). |
2029 |
- also redefinable (see CascadingNotification)" |
|
4481
f3f7e1af7489
added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2030 |
|
4488
db914d752859
must mark returned contexts as returnable
Claus Gittinger <cg@exept.de>
parents:
4484
diff
changeset
|
2031 |
<context: #return> |
db914d752859
must mark returned contexts as returnable
Claus Gittinger <cg@exept.de>
parents:
4484
diff
changeset
|
2032 |
<exception: #raise> |
db914d752859
must mark returned contexts as returnable
Claus Gittinger <cg@exept.de>
parents:
4484
diff
changeset
|
2033 |
|
4481
f3f7e1af7489
added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2034 |
|val| |
f3f7e1af7489
added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2035 |
|
21663 | 2036 |
(aHandlerBlock isBlockWithArgumentCount:1) ifTrue:[ |
2037 |
"1-arg handler - pass myself as exception argument" |
|
2038 |
val := aHandlerBlock value:self. |
|
6158
7fb96896ed4b
support 0-arg handler blocks
Claus Gittinger <cg@exept.de>
parents:
6036
diff
changeset
|
2039 |
] ifFalse:[ |
21663 | 2040 |
"0-arg handler or any object - not interested in the exception argument" |
2041 |
val := aHandlerBlock value |
|
6158
7fb96896ed4b
support 0-arg handler blocks
Claus Gittinger <cg@exept.de>
parents:
6036
diff
changeset
|
2042 |
]. |
7fb96896ed4b
support 0-arg handler blocks
Claus Gittinger <cg@exept.de>
parents:
6036
diff
changeset
|
2043 |
|
8691
8b83b6cb00ac
Use #argumentCount instead of #numArgs in #doCallHandler: - it is implemented in Object
Stefan Vogel <sv@exept.de>
parents:
8684
diff
changeset
|
2044 |
"handler fall through - is just like a #return:(aHandlerBlock value)" |
4481
f3f7e1af7489
added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2045 |
|
8691
8b83b6cb00ac
Use #argumentCount instead of #numArgs in #doCallHandler: - it is implemented in Object
Stefan Vogel <sv@exept.de>
parents:
8684
diff
changeset
|
2046 |
self return:val |
21663 | 2047 |
|
2048 |
"Modified: / 18-03-2017 / 18:08:40 / stefan" |
|
4481
f3f7e1af7489
added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2049 |
! |
f3f7e1af7489
added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2050 |
|
f3f7e1af7489
added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2051 |
doRaise |
8617 | 2052 |
"search through the context-calling chain for a handle-context |
2053 |
to the raising signal, a parent of it, or a SignalSet which includes |
|
4481
f3f7e1af7489
added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2054 |
the raising signal. |
f3f7e1af7489
added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2055 |
If found, ask the receiver for the handler and evaluate |
f3f7e1af7489
added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2056 |
it with the receiver exception as argument. |
f3f7e1af7489
added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2057 |
If no handler is found, perform the default #action method. |
f3f7e1af7489
added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2058 |
|
f3f7e1af7489
added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2059 |
ATTENTION: the code below depends on being called by #raise or |
f3f7e1af7489
added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2060 |
#raiseRequest for proper operation (it skips the sending context)." |
f3f7e1af7489
added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2061 |
|
4488
db914d752859
must mark returned contexts as returnable
Claus Gittinger <cg@exept.de>
parents:
4484
diff
changeset
|
2062 |
<context: #return> |
db914d752859
must mark returned contexts as returnable
Claus Gittinger <cg@exept.de>
parents:
4484
diff
changeset
|
2063 |
|
8313
2aa626e8e404
Fix do not execute an exception handler inside the do-block, when the
Stefan Vogel <sv@exept.de>
parents:
8254
diff
changeset
|
2064 |
|currentContext| |
2aa626e8e404
Fix do not execute an exception handler inside the do-block, when the
Stefan Vogel <sv@exept.de>
parents:
8254
diff
changeset
|
2065 |
|
2aa626e8e404
Fix do not execute an exception handler inside the do-block, when the
Stefan Vogel <sv@exept.de>
parents:
8254
diff
changeset
|
2066 |
"is nil a valid originator? If so, we need an extra |
2aa626e8e404
Fix do not execute an exception handler inside the do-block, when the
Stefan Vogel <sv@exept.de>
parents:
8254
diff
changeset
|
2067 |
instanceVariable to record the originator setting" |
4481
f3f7e1af7489
added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2068 |
originator isNil ifTrue:[ |
20186 | 2069 |
originator := suspendedContext homeReceiver |
4481
f3f7e1af7489
added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2070 |
]. |
15336 | 2071 |
|
13009
e068f228a24b
eliminated 1 to 2 message sends when raising
Claus Gittinger <cg@exept.de>
parents:
12940
diff
changeset
|
2072 |
signal isNil ifTrue:[ |
20186 | 2073 |
signal := self class |
13009
e068f228a24b
eliminated 1 to 2 message sends when raising
Claus Gittinger <cg@exept.de>
parents:
12940
diff
changeset
|
2074 |
] ifFalse:[ |
20186 | 2075 |
signal isExceptionCreator ifFalse:[ |
2076 |
"not an exception or Signal - there is something wrong here..." |
|
2077 |
SignalError raiseWith:signal errorString:'unexpected non-ExceptionCreator in calling context'. |
|
2078 |
] |
|
4481
f3f7e1af7489
added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2079 |
]. |
f3f7e1af7489
added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2080 |
|
8313
2aa626e8e404
Fix do not execute an exception handler inside the do-block, when the
Stefan Vogel <sv@exept.de>
parents:
8254
diff
changeset
|
2081 |
"now, start searching for a handler. |
2aa626e8e404
Fix do not execute an exception handler inside the do-block, when the
Stefan Vogel <sv@exept.de>
parents:
8254
diff
changeset
|
2082 |
Start search above the last active handler. |
2aa626e8e404
Fix do not execute an exception handler inside the do-block, when the
Stefan Vogel <sv@exept.de>
parents:
8254
diff
changeset
|
2083 |
Skip raise contexts. |
2aa626e8e404
Fix do not execute an exception handler inside the do-block, when the
Stefan Vogel <sv@exept.de>
parents:
8254
diff
changeset
|
2084 |
If nil, then there is no handler and we can directly proceed |
2aa626e8e404
Fix do not execute an exception handler inside the do-block, when the
Stefan Vogel <sv@exept.de>
parents:
8254
diff
changeset
|
2085 |
to the unhandled code below." |
2aa626e8e404
Fix do not execute an exception handler inside the do-block, when the
Stefan Vogel <sv@exept.de>
parents:
8254
diff
changeset
|
2086 |
|
2aa626e8e404
Fix do not execute an exception handler inside the do-block, when the
Stefan Vogel <sv@exept.de>
parents:
8254
diff
changeset
|
2087 |
currentContext := suspendedContext findExceptional. |
2aa626e8e404
Fix do not execute an exception handler inside the do-block, when the
Stefan Vogel <sv@exept.de>
parents:
8254
diff
changeset
|
2088 |
[currentContext notNil] whileTrue:[ |
20186 | 2089 |
(currentContext isRaiseContext) ifTrue:[ |
2090 |
|ex1 con1| |
|
2091 |
||
2092 |
"skip all the contexts between the raise and the sender of #handle:do" |
|
2093 |
ex1 := currentContext receiver. "exception, that has been raised" |
|
2094 |
con1 := ex1 handlerContext. "the context of the #handle:do:" |
|
2095 |
||
2096 |
con1 isNil ifTrue:[ |
|
2097 |
"the handlerContext is nil if an exception's default action is performed. |
|
2098 |
Start search at the sending context. |
|
2099 |
Maybe we should better treat a default action like a #handle:do: |
|
2100 |
at the outest level. But the DebugView currently can't handle this, |
|
2101 |
because it tries to raise e.g. AbortOperationRequest even if it has bee invoked |
|
2102 |
by e.g. NoHandlerError. |
|
2103 |
||
2104 |
Note that if raiseContext is nil, the exception |
|
2105 |
did already return." |
|
2106 |
||
2107 |
(ex1 creator == signal and:[ex1 raiseContext notNil]) ifTrue:[ |
|
2108 |
"the same exception that has been caught by a default action is raised again. |
|
2109 |
don't recurse" |
|
2110 |
^ self noHandler. |
|
2111 |
]. |
|
2112 |
] ifFalse:[ |
|
2113 |
"skip to the raised exception's handleContext" |
|
2114 |
currentContext := con1. |
|
2115 |
]. |
|
2116 |
ex1 := con1 := nil. |
|
2117 |
] ifFalse:[ "currentContext is a handleContext" |
|
2118 |
|r handler| |
|
2119 |
||
2120 |
"ask the receiver of the #handle:do: or #on:do: or whatever- message for the handler. |
|
2121 |
nil is returned, if the signal is not accepted" |
|
2122 |
r := currentContext receiver. "receiver of #handle:do: or #on:do:" |
|
2123 |
(r notNil and:[(handler := r handlerForSignal:signal |
|
2124 |
context:currentContext |
|
2125 |
originator:originator) notNil] |
|
2126 |
) ifTrue:[ |
|
2127 |
"call the handler" |
|
2128 |
||
2129 |
handlerContext := currentContext. |
|
2130 |
currentContext := nil. |
|
2131 |
self doCallHandler:handler. |
|
2132 |
||
2133 |
"if the handler rejects, we arrive here |
|
2134 |
continue search for another handler" |
|
2135 |
currentContext := handlerContext. |
|
2136 |
handler := handlerContext := nil. |
|
2137 |
]. |
|
2138 |
r := handler := nil. |
|
2139 |
]. |
|
2140 |
currentContext notNil ifTrue:[ |
|
2141 |
currentContext := currentContext findSpecialHandle:true raise:true. "search starts at currentContext sender" |
|
2142 |
]. |
|
4481
f3f7e1af7489
added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2143 |
]. |
f3f7e1af7489
added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2144 |
|
f3f7e1af7489
added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2145 |
" |
8617 | 2146 |
we arrive here, if either no handler was found, |
4481
f3f7e1af7489
added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2147 |
or every handler rejected. |
f3f7e1af7489
added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2148 |
" |
4484
9476c82921d0
eliminated proceedBlock and rejectBlock;
Claus Gittinger <cg@exept.de>
parents:
4483
diff
changeset
|
2149 |
^ self doCallAction |
4481
f3f7e1af7489
added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2150 |
|
13009
e068f228a24b
eliminated 1 to 2 message sends when raising
Claus Gittinger <cg@exept.de>
parents:
12940
diff
changeset
|
2151 |
"Created: / 12-05-1996 / 15:09:39 / cg" |
e068f228a24b
eliminated 1 to 2 message sends when raising
Claus Gittinger <cg@exept.de>
parents:
12940
diff
changeset
|
2152 |
"Modified: / 03-08-1999 / 11:20:41 / stefan" |
e068f228a24b
eliminated 1 to 2 message sends when raising
Claus Gittinger <cg@exept.de>
parents:
12940
diff
changeset
|
2153 |
"Modified: / 10-08-2010 / 09:26:14 / cg" |
4481
f3f7e1af7489
added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2154 |
! ! |
f3f7e1af7489
added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2155 |
|
f3f7e1af7489
added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2156 |
!GenericException methodsFor:'raising'! |
f3f7e1af7489
added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2157 |
|
f3f7e1af7489
added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2158 |
raise |
4484
9476c82921d0
eliminated proceedBlock and rejectBlock;
Claus Gittinger <cg@exept.de>
parents:
4483
diff
changeset
|
2159 |
"actually raise a non-proceedable exception" |
4481
f3f7e1af7489
added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2160 |
|
4556 | 2161 |
<context: #return> |
2162 |
||
9992
0774694cf9b3
- Add raiseContext as instance variable for faster #resume
Stefan Vogel <sv@exept.de>
parents:
9505
diff
changeset
|
2163 |
raiseContext := thisContext. |
17105 | 2164 |
(suspendedContext isNil or:[handlerContext notNil]) ifTrue:[ |
2165 |
suspendedContext := raiseContext sender |
|
4481
f3f7e1af7489
added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2166 |
]. |
f3f7e1af7489
added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2167 |
|
f3f7e1af7489
added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2168 |
proceedable := false. |
f3f7e1af7489
added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2169 |
^ self doRaise |
f3f7e1af7489
added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2170 |
|
f3f7e1af7489
added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2171 |
"Modified: / 12.5.1996 / 15:09:47 / cg" |
4507 | 2172 |
"Modified: / 3.8.1999 / 13:33:01 / stefan" |
4481
f3f7e1af7489
added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2173 |
! |
f3f7e1af7489
added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2174 |
|
19344 | 2175 |
raiseErrorString:aString |
2176 |
"raise the signal nonproceedable. |
|
2177 |
The argument, aString is used as messageText" |
|
2178 |
||
2179 |
<context: #return> |
|
2180 |
||
2181 |
raiseContext := thisContext. |
|
2182 |
suspendedContext := thisContext sender. |
|
2183 |
messageText := aString. |
|
2184 |
proceedable := false. |
|
2185 |
||
2186 |
^ self doRaise |
|
2187 |
! |
|
2188 |
||
13009
e068f228a24b
eliminated 1 to 2 message sends when raising
Claus Gittinger <cg@exept.de>
parents:
12940
diff
changeset
|
2189 |
raiseErrorString:aString in:aContext |
e068f228a24b
eliminated 1 to 2 message sends when raising
Claus Gittinger <cg@exept.de>
parents:
12940
diff
changeset
|
2190 |
"raise the signal nonproceedable. |
e068f228a24b
eliminated 1 to 2 message sends when raising
Claus Gittinger <cg@exept.de>
parents:
12940
diff
changeset
|
2191 |
The argument, aString is used as messageText" |
e068f228a24b
eliminated 1 to 2 message sends when raising
Claus Gittinger <cg@exept.de>
parents:
12940
diff
changeset
|
2192 |
|
e068f228a24b
eliminated 1 to 2 message sends when raising
Claus Gittinger <cg@exept.de>
parents:
12940
diff
changeset
|
2193 |
<context: #return> |
e068f228a24b
eliminated 1 to 2 message sends when raising
Claus Gittinger <cg@exept.de>
parents:
12940
diff
changeset
|
2194 |
|
e068f228a24b
eliminated 1 to 2 message sends when raising
Claus Gittinger <cg@exept.de>
parents:
12940
diff
changeset
|
2195 |
raiseContext := thisContext. |
e068f228a24b
eliminated 1 to 2 message sends when raising
Claus Gittinger <cg@exept.de>
parents:
12940
diff
changeset
|
2196 |
suspendedContext := aContext. |
e068f228a24b
eliminated 1 to 2 message sends when raising
Claus Gittinger <cg@exept.de>
parents:
12940
diff
changeset
|
2197 |
messageText := aString. |
e068f228a24b
eliminated 1 to 2 message sends when raising
Claus Gittinger <cg@exept.de>
parents:
12940
diff
changeset
|
2198 |
proceedable := false. |
e068f228a24b
eliminated 1 to 2 message sends when raising
Claus Gittinger <cg@exept.de>
parents:
12940
diff
changeset
|
2199 |
|
e068f228a24b
eliminated 1 to 2 message sends when raising
Claus Gittinger <cg@exept.de>
parents:
12940
diff
changeset
|
2200 |
^ self doRaise |
e068f228a24b
eliminated 1 to 2 message sends when raising
Claus Gittinger <cg@exept.de>
parents:
12940
diff
changeset
|
2201 |
|
e068f228a24b
eliminated 1 to 2 message sends when raising
Claus Gittinger <cg@exept.de>
parents:
12940
diff
changeset
|
2202 |
"Created: / 10-08-2010 / 09:33:43 / cg" |
e068f228a24b
eliminated 1 to 2 message sends when raising
Claus Gittinger <cg@exept.de>
parents:
12940
diff
changeset
|
2203 |
! |
e068f228a24b
eliminated 1 to 2 message sends when raising
Claus Gittinger <cg@exept.de>
parents:
12940
diff
changeset
|
2204 |
|
e068f228a24b
eliminated 1 to 2 message sends when raising
Claus Gittinger <cg@exept.de>
parents:
12940
diff
changeset
|
2205 |
raiseIn:aContext |
e068f228a24b
eliminated 1 to 2 message sends when raising
Claus Gittinger <cg@exept.de>
parents:
12940
diff
changeset
|
2206 |
"actually raise a non-proceedable exception" |
e068f228a24b
eliminated 1 to 2 message sends when raising
Claus Gittinger <cg@exept.de>
parents:
12940
diff
changeset
|
2207 |
|
e068f228a24b
eliminated 1 to 2 message sends when raising
Claus Gittinger <cg@exept.de>
parents:
12940
diff
changeset
|
2208 |
<context: #return> |
e068f228a24b
eliminated 1 to 2 message sends when raising
Claus Gittinger <cg@exept.de>
parents:
12940
diff
changeset
|
2209 |
|
e068f228a24b
eliminated 1 to 2 message sends when raising
Claus Gittinger <cg@exept.de>
parents:
12940
diff
changeset
|
2210 |
raiseContext := thisContext. |
e068f228a24b
eliminated 1 to 2 message sends when raising
Claus Gittinger <cg@exept.de>
parents:
12940
diff
changeset
|
2211 |
suspendedContext := aContext. |
e068f228a24b
eliminated 1 to 2 message sends when raising
Claus Gittinger <cg@exept.de>
parents:
12940
diff
changeset
|
2212 |
proceedable := false. |
e068f228a24b
eliminated 1 to 2 message sends when raising
Claus Gittinger <cg@exept.de>
parents:
12940
diff
changeset
|
2213 |
|
e068f228a24b
eliminated 1 to 2 message sends when raising
Claus Gittinger <cg@exept.de>
parents:
12940
diff
changeset
|
2214 |
^ self doRaise |
e068f228a24b
eliminated 1 to 2 message sends when raising
Claus Gittinger <cg@exept.de>
parents:
12940
diff
changeset
|
2215 |
|
e068f228a24b
eliminated 1 to 2 message sends when raising
Claus Gittinger <cg@exept.de>
parents:
12940
diff
changeset
|
2216 |
"Modified: / 03-08-1999 / 13:33:01 / stefan" |
e068f228a24b
eliminated 1 to 2 message sends when raising
Claus Gittinger <cg@exept.de>
parents:
12940
diff
changeset
|
2217 |
"Created: / 10-08-2010 / 09:30:19 / cg" |
e068f228a24b
eliminated 1 to 2 message sends when raising
Claus Gittinger <cg@exept.de>
parents:
12940
diff
changeset
|
2218 |
! |
e068f228a24b
eliminated 1 to 2 message sends when raising
Claus Gittinger <cg@exept.de>
parents:
12940
diff
changeset
|
2219 |
|
17106 | 2220 |
raiseRequest |
2221 |
"actually raise a proceedable exception." |
|
2222 |
||
2223 |
<context: #return> |
|
2224 |
||
2225 |
raiseContext := thisContext. |
|
2226 |
(suspendedContext isNil or:[handlerContext notNil]) ifTrue:[ |
|
2227 |
handlerContext := nil. |
|
2228 |
suspendedContext := raiseContext sender |
|
2229 |
]. |
|
2230 |
||
2231 |
self checkProceedable. |
|
2232 |
||
2233 |
proceedable := true. |
|
2234 |
^ self doRaise |
|
2235 |
||
2236 |
"Modified: / 04-08-1999 / 08:05:12 / stefan" |
|
2237 |
"Modified: / 10-08-2010 / 09:55:00 / cg" |
|
2238 |
! |
|
2239 |
||
13009
e068f228a24b
eliminated 1 to 2 message sends when raising
Claus Gittinger <cg@exept.de>
parents:
12940
diff
changeset
|
2240 |
raiseRequestErrorString:errorString in:aContext |
e068f228a24b
eliminated 1 to 2 message sends when raising
Claus Gittinger <cg@exept.de>
parents:
12940
diff
changeset
|
2241 |
"actually raise a proceedable exception." |
e068f228a24b
eliminated 1 to 2 message sends when raising
Claus Gittinger <cg@exept.de>
parents:
12940
diff
changeset
|
2242 |
|
e068f228a24b
eliminated 1 to 2 message sends when raising
Claus Gittinger <cg@exept.de>
parents:
12940
diff
changeset
|
2243 |
<context: #return> |
e068f228a24b
eliminated 1 to 2 message sends when raising
Claus Gittinger <cg@exept.de>
parents:
12940
diff
changeset
|
2244 |
|
e068f228a24b
eliminated 1 to 2 message sends when raising
Claus Gittinger <cg@exept.de>
parents:
12940
diff
changeset
|
2245 |
raiseContext := thisContext. |
e068f228a24b
eliminated 1 to 2 message sends when raising
Claus Gittinger <cg@exept.de>
parents:
12940
diff
changeset
|
2246 |
suspendedContext := aContext. |
e068f228a24b
eliminated 1 to 2 message sends when raising
Claus Gittinger <cg@exept.de>
parents:
12940
diff
changeset
|
2247 |
messageText := errorString. |
e068f228a24b
eliminated 1 to 2 message sends when raising
Claus Gittinger <cg@exept.de>
parents:
12940
diff
changeset
|
2248 |
|
e068f228a24b
eliminated 1 to 2 message sends when raising
Claus Gittinger <cg@exept.de>
parents:
12940
diff
changeset
|
2249 |
self checkProceedable. |
e068f228a24b
eliminated 1 to 2 message sends when raising
Claus Gittinger <cg@exept.de>
parents:
12940
diff
changeset
|
2250 |
|
e068f228a24b
eliminated 1 to 2 message sends when raising
Claus Gittinger <cg@exept.de>
parents:
12940
diff
changeset
|
2251 |
proceedable := true. |
e068f228a24b
eliminated 1 to 2 message sends when raising
Claus Gittinger <cg@exept.de>
parents:
12940
diff
changeset
|
2252 |
^ self doRaise |
e068f228a24b
eliminated 1 to 2 message sends when raising
Claus Gittinger <cg@exept.de>
parents:
12940
diff
changeset
|
2253 |
|
e068f228a24b
eliminated 1 to 2 message sends when raising
Claus Gittinger <cg@exept.de>
parents:
12940
diff
changeset
|
2254 |
"Modified: / 04-08-1999 / 08:05:12 / stefan" |
e068f228a24b
eliminated 1 to 2 message sends when raising
Claus Gittinger <cg@exept.de>
parents:
12940
diff
changeset
|
2255 |
"Created: / 10-08-2010 / 09:40:05 / cg" |
e068f228a24b
eliminated 1 to 2 message sends when raising
Claus Gittinger <cg@exept.de>
parents:
12940
diff
changeset
|
2256 |
! |
e068f228a24b
eliminated 1 to 2 message sends when raising
Claus Gittinger <cg@exept.de>
parents:
12940
diff
changeset
|
2257 |
|
e068f228a24b
eliminated 1 to 2 message sends when raising
Claus Gittinger <cg@exept.de>
parents:
12940
diff
changeset
|
2258 |
raiseRequestIn:aContext |
e068f228a24b
eliminated 1 to 2 message sends when raising
Claus Gittinger <cg@exept.de>
parents:
12940
diff
changeset
|
2259 |
"actually raise a proceedable exception." |
e068f228a24b
eliminated 1 to 2 message sends when raising
Claus Gittinger <cg@exept.de>
parents:
12940
diff
changeset
|
2260 |
|
e068f228a24b
eliminated 1 to 2 message sends when raising
Claus Gittinger <cg@exept.de>
parents:
12940
diff
changeset
|
2261 |
<context: #return> |
e068f228a24b
eliminated 1 to 2 message sends when raising
Claus Gittinger <cg@exept.de>
parents:
12940
diff
changeset
|
2262 |
|
e068f228a24b
eliminated 1 to 2 message sends when raising
Claus Gittinger <cg@exept.de>
parents:
12940
diff
changeset
|
2263 |
raiseContext := thisContext. |
e068f228a24b
eliminated 1 to 2 message sends when raising
Claus Gittinger <cg@exept.de>
parents:
12940
diff
changeset
|
2264 |
suspendedContext := aContext. |
e068f228a24b
eliminated 1 to 2 message sends when raising
Claus Gittinger <cg@exept.de>
parents:
12940
diff
changeset
|
2265 |
|
e068f228a24b
eliminated 1 to 2 message sends when raising
Claus Gittinger <cg@exept.de>
parents:
12940
diff
changeset
|
2266 |
self checkProceedable. |
e068f228a24b
eliminated 1 to 2 message sends when raising
Claus Gittinger <cg@exept.de>
parents:
12940
diff
changeset
|
2267 |
|
e068f228a24b
eliminated 1 to 2 message sends when raising
Claus Gittinger <cg@exept.de>
parents:
12940
diff
changeset
|
2268 |
proceedable := true. |
e068f228a24b
eliminated 1 to 2 message sends when raising
Claus Gittinger <cg@exept.de>
parents:
12940
diff
changeset
|
2269 |
^ self doRaise |
e068f228a24b
eliminated 1 to 2 message sends when raising
Claus Gittinger <cg@exept.de>
parents:
12940
diff
changeset
|
2270 |
|
e068f228a24b
eliminated 1 to 2 message sends when raising
Claus Gittinger <cg@exept.de>
parents:
12940
diff
changeset
|
2271 |
"Modified: / 04-08-1999 / 08:05:12 / stefan" |
e068f228a24b
eliminated 1 to 2 message sends when raising
Claus Gittinger <cg@exept.de>
parents:
12940
diff
changeset
|
2272 |
"Created: / 10-08-2010 / 09:36:45 / cg" |
5680 | 2273 |
! |
2274 |
||
8774
2bb732840713
+raiseWith / raiseRequestWith
Claus Gittinger <cg@exept.de>
parents:
8733
diff
changeset
|
2275 |
raiseRequestWith:aParameter errorString:aString |
2bb732840713
+raiseWith / raiseRequestWith
Claus Gittinger <cg@exept.de>
parents:
8733
diff
changeset
|
2276 |
"raise the signal proceedable. |
2bb732840713
+raiseWith / raiseRequestWith
Claus Gittinger <cg@exept.de>
parents:
8733
diff
changeset
|
2277 |
The argument, aString is used as messageText, |
2bb732840713
+raiseWith / raiseRequestWith
Claus Gittinger <cg@exept.de>
parents:
8733
diff
changeset
|
2278 |
aParameter is passed as exception parameter." |
2bb732840713
+raiseWith / raiseRequestWith
Claus Gittinger <cg@exept.de>
parents:
8733
diff
changeset
|
2279 |
|
2bb732840713
+raiseWith / raiseRequestWith
Claus Gittinger <cg@exept.de>
parents:
8733
diff
changeset
|
2280 |
<context: #return> |
2bb732840713
+raiseWith / raiseRequestWith
Claus Gittinger <cg@exept.de>
parents:
8733
diff
changeset
|
2281 |
|
16555 | 2282 |
^ (self |
2283 |
suspendedContext:thisContext sender parameter:aParameter errorString:aString) |
|
2284 |
raiseRequest. |
|
8774
2bb732840713
+raiseWith / raiseRequestWith
Claus Gittinger <cg@exept.de>
parents:
8733
diff
changeset
|
2285 |
"Created: / 23.7.1999 / 14:08:57 / stefan" |
2bb732840713
+raiseWith / raiseRequestWith
Claus Gittinger <cg@exept.de>
parents:
8733
diff
changeset
|
2286 |
! |
2bb732840713
+raiseWith / raiseRequestWith
Claus Gittinger <cg@exept.de>
parents:
8733
diff
changeset
|
2287 |
|
13009
e068f228a24b
eliminated 1 to 2 message sends when raising
Claus Gittinger <cg@exept.de>
parents:
12940
diff
changeset
|
2288 |
raiseRequestWith:aParameter errorString:aString in:aContext |
e068f228a24b
eliminated 1 to 2 message sends when raising
Claus Gittinger <cg@exept.de>
parents:
12940
diff
changeset
|
2289 |
"actually raise a proceedable exception." |
e068f228a24b
eliminated 1 to 2 message sends when raising
Claus Gittinger <cg@exept.de>
parents:
12940
diff
changeset
|
2290 |
|
e068f228a24b
eliminated 1 to 2 message sends when raising
Claus Gittinger <cg@exept.de>
parents:
12940
diff
changeset
|
2291 |
<context: #return> |
e068f228a24b
eliminated 1 to 2 message sends when raising
Claus Gittinger <cg@exept.de>
parents:
12940
diff
changeset
|
2292 |
|
e068f228a24b
eliminated 1 to 2 message sends when raising
Claus Gittinger <cg@exept.de>
parents:
12940
diff
changeset
|
2293 |
raiseContext := thisContext. |
e068f228a24b
eliminated 1 to 2 message sends when raising
Claus Gittinger <cg@exept.de>
parents:
12940
diff
changeset
|
2294 |
suspendedContext := aContext. |
e068f228a24b
eliminated 1 to 2 message sends when raising
Claus Gittinger <cg@exept.de>
parents:
12940
diff
changeset
|
2295 |
parameter := aParameter. |
e068f228a24b
eliminated 1 to 2 message sends when raising
Claus Gittinger <cg@exept.de>
parents:
12940
diff
changeset
|
2296 |
messageText := aString. |
e068f228a24b
eliminated 1 to 2 message sends when raising
Claus Gittinger <cg@exept.de>
parents:
12940
diff
changeset
|
2297 |
|
e068f228a24b
eliminated 1 to 2 message sends when raising
Claus Gittinger <cg@exept.de>
parents:
12940
diff
changeset
|
2298 |
self checkProceedable. |
e068f228a24b
eliminated 1 to 2 message sends when raising
Claus Gittinger <cg@exept.de>
parents:
12940
diff
changeset
|
2299 |
|
e068f228a24b
eliminated 1 to 2 message sends when raising
Claus Gittinger <cg@exept.de>
parents:
12940
diff
changeset
|
2300 |
proceedable := true. |
e068f228a24b
eliminated 1 to 2 message sends when raising
Claus Gittinger <cg@exept.de>
parents:
12940
diff
changeset
|
2301 |
^ self doRaise |
e068f228a24b
eliminated 1 to 2 message sends when raising
Claus Gittinger <cg@exept.de>
parents:
12940
diff
changeset
|
2302 |
|
e068f228a24b
eliminated 1 to 2 message sends when raising
Claus Gittinger <cg@exept.de>
parents:
12940
diff
changeset
|
2303 |
"Modified: / 04-08-1999 / 08:05:12 / stefan" |
e068f228a24b
eliminated 1 to 2 message sends when raising
Claus Gittinger <cg@exept.de>
parents:
12940
diff
changeset
|
2304 |
"Created: / 10-08-2010 / 09:55:48 / cg" |
e068f228a24b
eliminated 1 to 2 message sends when raising
Claus Gittinger <cg@exept.de>
parents:
12940
diff
changeset
|
2305 |
! |
e068f228a24b
eliminated 1 to 2 message sends when raising
Claus Gittinger <cg@exept.de>
parents:
12940
diff
changeset
|
2306 |
|
e068f228a24b
eliminated 1 to 2 message sends when raising
Claus Gittinger <cg@exept.de>
parents:
12940
diff
changeset
|
2307 |
raiseRequestWith:aParameter in:aContext |
e068f228a24b
eliminated 1 to 2 message sends when raising
Claus Gittinger <cg@exept.de>
parents:
12940
diff
changeset
|
2308 |
"actually raise a proceedable exception." |
e068f228a24b
eliminated 1 to 2 message sends when raising
Claus Gittinger <cg@exept.de>
parents:
12940
diff
changeset
|
2309 |
|
e068f228a24b
eliminated 1 to 2 message sends when raising
Claus Gittinger <cg@exept.de>
parents:
12940
diff
changeset
|
2310 |
<context: #return> |
e068f228a24b
eliminated 1 to 2 message sends when raising
Claus Gittinger <cg@exept.de>
parents:
12940
diff
changeset
|
2311 |
|
e068f228a24b
eliminated 1 to 2 message sends when raising
Claus Gittinger <cg@exept.de>
parents:
12940
diff
changeset
|
2312 |
raiseContext := thisContext. |
e068f228a24b
eliminated 1 to 2 message sends when raising
Claus Gittinger <cg@exept.de>
parents:
12940
diff
changeset
|
2313 |
suspendedContext := aContext. |
e068f228a24b
eliminated 1 to 2 message sends when raising
Claus Gittinger <cg@exept.de>
parents:
12940
diff
changeset
|
2314 |
parameter := aParameter. |
e068f228a24b
eliminated 1 to 2 message sends when raising
Claus Gittinger <cg@exept.de>
parents:
12940
diff
changeset
|
2315 |
|
e068f228a24b
eliminated 1 to 2 message sends when raising
Claus Gittinger <cg@exept.de>
parents:
12940
diff
changeset
|
2316 |
self checkProceedable. |
e068f228a24b
eliminated 1 to 2 message sends when raising
Claus Gittinger <cg@exept.de>
parents:
12940
diff
changeset
|
2317 |
|
e068f228a24b
eliminated 1 to 2 message sends when raising
Claus Gittinger <cg@exept.de>
parents:
12940
diff
changeset
|
2318 |
proceedable := true. |
e068f228a24b
eliminated 1 to 2 message sends when raising
Claus Gittinger <cg@exept.de>
parents:
12940
diff
changeset
|
2319 |
^ self doRaise |
e068f228a24b
eliminated 1 to 2 message sends when raising
Claus Gittinger <cg@exept.de>
parents:
12940
diff
changeset
|
2320 |
|
e068f228a24b
eliminated 1 to 2 message sends when raising
Claus Gittinger <cg@exept.de>
parents:
12940
diff
changeset
|
2321 |
"Modified: / 04-08-1999 / 08:05:12 / stefan" |
e068f228a24b
eliminated 1 to 2 message sends when raising
Claus Gittinger <cg@exept.de>
parents:
12940
diff
changeset
|
2322 |
"Created: / 10-08-2010 / 09:53:51 / cg" |
e068f228a24b
eliminated 1 to 2 message sends when raising
Claus Gittinger <cg@exept.de>
parents:
12940
diff
changeset
|
2323 |
! |
e068f228a24b
eliminated 1 to 2 message sends when raising
Claus Gittinger <cg@exept.de>
parents:
12940
diff
changeset
|
2324 |
|
5680 | 2325 |
raiseSignal |
2326 |
"actually raise an exception (whatever the proceedability is)." |
|
2327 |
||
6430
9a1580465dd2
better impl. of #deferAfter:
Claus Gittinger <cg@exept.de>
parents:
6426
diff
changeset
|
2328 |
<context: #return> |
15954 | 2329 |
<resource: #skipInDebuggersWalkBack> |
2330 |
||
6430
9a1580465dd2
better impl. of #deferAfter:
Claus Gittinger <cg@exept.de>
parents:
6426
diff
changeset
|
2331 |
|
9992
0774694cf9b3
- Add raiseContext as instance variable for faster #resume
Stefan Vogel <sv@exept.de>
parents:
9505
diff
changeset
|
2332 |
raiseContext := thisContext. |
17105 | 2333 |
(suspendedContext isNil or:[handlerContext notNil]) ifTrue:[ |
2334 |
suspendedContext := raiseContext sender |
|
5680 | 2335 |
]. |
8684
9c00854305f7
QuerySignal generates Notifications instead of Exceptions.
Stefan Vogel <sv@exept.de>
parents:
8681
diff
changeset
|
2336 |
proceedable := self mayProceed. |
9c00854305f7
QuerySignal generates Notifications instead of Exceptions.
Stefan Vogel <sv@exept.de>
parents:
8681
diff
changeset
|
2337 |
^ self doRaise |
15954 | 2338 |
|
2339 |
"Modified: / 19-04-2013 / 09:37:50 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
8774
2bb732840713
+raiseWith / raiseRequestWith
Claus Gittinger <cg@exept.de>
parents:
8733
diff
changeset
|
2340 |
! |
2bb732840713
+raiseWith / raiseRequestWith
Claus Gittinger <cg@exept.de>
parents:
8733
diff
changeset
|
2341 |
|
2bb732840713
+raiseWith / raiseRequestWith
Claus Gittinger <cg@exept.de>
parents:
8733
diff
changeset
|
2342 |
raiseWith:aParameter errorString:aString |
2bb732840713
+raiseWith / raiseRequestWith
Claus Gittinger <cg@exept.de>
parents:
8733
diff
changeset
|
2343 |
"raise the signal nonproceedable. |
2bb732840713
+raiseWith / raiseRequestWith
Claus Gittinger <cg@exept.de>
parents:
8733
diff
changeset
|
2344 |
The argument, aString is used as messageText, |
2bb732840713
+raiseWith / raiseRequestWith
Claus Gittinger <cg@exept.de>
parents:
8733
diff
changeset
|
2345 |
aParameter is passed as exception parameter." |
2bb732840713
+raiseWith / raiseRequestWith
Claus Gittinger <cg@exept.de>
parents:
8733
diff
changeset
|
2346 |
|
2bb732840713
+raiseWith / raiseRequestWith
Claus Gittinger <cg@exept.de>
parents:
8733
diff
changeset
|
2347 |
<context: #return> |
2bb732840713
+raiseWith / raiseRequestWith
Claus Gittinger <cg@exept.de>
parents:
8733
diff
changeset
|
2348 |
|
16555 | 2349 |
^ (self |
2350 |
suspendedContext:thisContext sender parameter:aParameter errorString:aString) |
|
2351 |
raise. |
|
13009
e068f228a24b
eliminated 1 to 2 message sends when raising
Claus Gittinger <cg@exept.de>
parents:
12940
diff
changeset
|
2352 |
! |
e068f228a24b
eliminated 1 to 2 message sends when raising
Claus Gittinger <cg@exept.de>
parents:
12940
diff
changeset
|
2353 |
|
e068f228a24b
eliminated 1 to 2 message sends when raising
Claus Gittinger <cg@exept.de>
parents:
12940
diff
changeset
|
2354 |
raiseWith:aParameter errorString:aString in:aContext |
e068f228a24b
eliminated 1 to 2 message sends when raising
Claus Gittinger <cg@exept.de>
parents:
12940
diff
changeset
|
2355 |
"raise the signal nonproceedable. |
e068f228a24b
eliminated 1 to 2 message sends when raising
Claus Gittinger <cg@exept.de>
parents:
12940
diff
changeset
|
2356 |
The argument, aString is used as messageText" |
e068f228a24b
eliminated 1 to 2 message sends when raising
Claus Gittinger <cg@exept.de>
parents:
12940
diff
changeset
|
2357 |
|
e068f228a24b
eliminated 1 to 2 message sends when raising
Claus Gittinger <cg@exept.de>
parents:
12940
diff
changeset
|
2358 |
<context: #return> |
e068f228a24b
eliminated 1 to 2 message sends when raising
Claus Gittinger <cg@exept.de>
parents:
12940
diff
changeset
|
2359 |
|
e068f228a24b
eliminated 1 to 2 message sends when raising
Claus Gittinger <cg@exept.de>
parents:
12940
diff
changeset
|
2360 |
raiseContext := thisContext. |
e068f228a24b
eliminated 1 to 2 message sends when raising
Claus Gittinger <cg@exept.de>
parents:
12940
diff
changeset
|
2361 |
suspendedContext := aContext. |
e068f228a24b
eliminated 1 to 2 message sends when raising
Claus Gittinger <cg@exept.de>
parents:
12940
diff
changeset
|
2362 |
messageText := aString. |
e068f228a24b
eliminated 1 to 2 message sends when raising
Claus Gittinger <cg@exept.de>
parents:
12940
diff
changeset
|
2363 |
parameter := aParameter. |
e068f228a24b
eliminated 1 to 2 message sends when raising
Claus Gittinger <cg@exept.de>
parents:
12940
diff
changeset
|
2364 |
proceedable := false. |
e068f228a24b
eliminated 1 to 2 message sends when raising
Claus Gittinger <cg@exept.de>
parents:
12940
diff
changeset
|
2365 |
|
e068f228a24b
eliminated 1 to 2 message sends when raising
Claus Gittinger <cg@exept.de>
parents:
12940
diff
changeset
|
2366 |
^ self doRaise |
e068f228a24b
eliminated 1 to 2 message sends when raising
Claus Gittinger <cg@exept.de>
parents:
12940
diff
changeset
|
2367 |
|
e068f228a24b
eliminated 1 to 2 message sends when raising
Claus Gittinger <cg@exept.de>
parents:
12940
diff
changeset
|
2368 |
"Created: / 10-08-2010 / 09:51:51 / cg" |
e068f228a24b
eliminated 1 to 2 message sends when raising
Claus Gittinger <cg@exept.de>
parents:
12940
diff
changeset
|
2369 |
! |
e068f228a24b
eliminated 1 to 2 message sends when raising
Claus Gittinger <cg@exept.de>
parents:
12940
diff
changeset
|
2370 |
|
e068f228a24b
eliminated 1 to 2 message sends when raising
Claus Gittinger <cg@exept.de>
parents:
12940
diff
changeset
|
2371 |
raiseWith:aParameter in:aContext |
e068f228a24b
eliminated 1 to 2 message sends when raising
Claus Gittinger <cg@exept.de>
parents:
12940
diff
changeset
|
2372 |
"raise the signal nonproceedable. |
e068f228a24b
eliminated 1 to 2 message sends when raising
Claus Gittinger <cg@exept.de>
parents:
12940
diff
changeset
|
2373 |
The argument, aString is used as messageText" |
e068f228a24b
eliminated 1 to 2 message sends when raising
Claus Gittinger <cg@exept.de>
parents:
12940
diff
changeset
|
2374 |
|
e068f228a24b
eliminated 1 to 2 message sends when raising
Claus Gittinger <cg@exept.de>
parents:
12940
diff
changeset
|
2375 |
<context: #return> |
e068f228a24b
eliminated 1 to 2 message sends when raising
Claus Gittinger <cg@exept.de>
parents:
12940
diff
changeset
|
2376 |
|
e068f228a24b
eliminated 1 to 2 message sends when raising
Claus Gittinger <cg@exept.de>
parents:
12940
diff
changeset
|
2377 |
raiseContext := thisContext. |
e068f228a24b
eliminated 1 to 2 message sends when raising
Claus Gittinger <cg@exept.de>
parents:
12940
diff
changeset
|
2378 |
suspendedContext := aContext. |
e068f228a24b
eliminated 1 to 2 message sends when raising
Claus Gittinger <cg@exept.de>
parents:
12940
diff
changeset
|
2379 |
parameter := aParameter. |
e068f228a24b
eliminated 1 to 2 message sends when raising
Claus Gittinger <cg@exept.de>
parents:
12940
diff
changeset
|
2380 |
proceedable := false. |
e068f228a24b
eliminated 1 to 2 message sends when raising
Claus Gittinger <cg@exept.de>
parents:
12940
diff
changeset
|
2381 |
|
e068f228a24b
eliminated 1 to 2 message sends when raising
Claus Gittinger <cg@exept.de>
parents:
12940
diff
changeset
|
2382 |
^ self doRaise |
e068f228a24b
eliminated 1 to 2 message sends when raising
Claus Gittinger <cg@exept.de>
parents:
12940
diff
changeset
|
2383 |
|
e068f228a24b
eliminated 1 to 2 message sends when raising
Claus Gittinger <cg@exept.de>
parents:
12940
diff
changeset
|
2384 |
"Created: / 10-08-2010 / 09:50:54 / cg" |
5697
ce78c7d9ddbd
raiseSignal / raiseSignal: / raiseSignal:with:
Claus Gittinger <cg@exept.de>
parents:
5684
diff
changeset
|
2385 |
! ! |
4481
f3f7e1af7489
added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2386 |
|
f3f7e1af7489
added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2387 |
!GenericException methodsFor:'setup'! |
f3f7e1af7489
added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2388 |
|
15237 | 2389 |
creator:aSignal |
6945
9536335d243b
use setSignal, to avoid conflict with dolphin signals
Claus Gittinger <cg@exept.de>
parents:
6920
diff
changeset
|
2390 |
"set the fields usable for inspection by the handler |
15237 | 2391 |
- only to be sent from the signal when raising." |
6945
9536335d243b
use setSignal, to avoid conflict with dolphin signals
Claus Gittinger <cg@exept.de>
parents:
6920
diff
changeset
|
2392 |
|
9536335d243b
use setSignal, to avoid conflict with dolphin signals
Claus Gittinger <cg@exept.de>
parents:
6920
diff
changeset
|
2393 |
signal := aSignal. |
9536335d243b
use setSignal, to avoid conflict with dolphin signals
Claus Gittinger <cg@exept.de>
parents:
6920
diff
changeset
|
2394 |
! |
9536335d243b
use setSignal, to avoid conflict with dolphin signals
Claus Gittinger <cg@exept.de>
parents:
6920
diff
changeset
|
2395 |
|
6430
9a1580465dd2
better impl. of #deferAfter:
Claus Gittinger <cg@exept.de>
parents:
6426
diff
changeset
|
2396 |
suspendedContext:sContext errorString:aString |
8617 | 2397 |
"set required fields |
6430
9a1580465dd2
better impl. of #deferAfter:
Claus Gittinger <cg@exept.de>
parents:
6426
diff
changeset
|
2398 |
- only to be sent from the signal when raising" |
9a1580465dd2
better impl. of #deferAfter:
Claus Gittinger <cg@exept.de>
parents:
6426
diff
changeset
|
2399 |
|
8313
2aa626e8e404
Fix do not execute an exception handler inside the do-block, when the
Stefan Vogel <sv@exept.de>
parents:
8254
diff
changeset
|
2400 |
messageText := aString. |
6430
9a1580465dd2
better impl. of #deferAfter:
Claus Gittinger <cg@exept.de>
parents:
6426
diff
changeset
|
2401 |
suspendedContext := sContext. |
9a1580465dd2
better impl. of #deferAfter:
Claus Gittinger <cg@exept.de>
parents:
6426
diff
changeset
|
2402 |
! |
9a1580465dd2
better impl. of #deferAfter:
Claus Gittinger <cg@exept.de>
parents:
6426
diff
changeset
|
2403 |
|
8684
9c00854305f7
QuerySignal generates Notifications instead of Exceptions.
Stefan Vogel <sv@exept.de>
parents:
8681
diff
changeset
|
2404 |
suspendedContext:aContext messageText:aString parameter:aParameter originator:anOriginator |
9c00854305f7
QuerySignal generates Notifications instead of Exceptions.
Stefan Vogel <sv@exept.de>
parents:
8681
diff
changeset
|
2405 |
suspendedContext := aContext. |
9c00854305f7
QuerySignal generates Notifications instead of Exceptions.
Stefan Vogel <sv@exept.de>
parents:
8681
diff
changeset
|
2406 |
messageText := aString. |
9c00854305f7
QuerySignal generates Notifications instead of Exceptions.
Stefan Vogel <sv@exept.de>
parents:
8681
diff
changeset
|
2407 |
parameter := aParameter. |
9c00854305f7
QuerySignal generates Notifications instead of Exceptions.
Stefan Vogel <sv@exept.de>
parents:
8681
diff
changeset
|
2408 |
originator := anOriginator. |
9c00854305f7
QuerySignal generates Notifications instead of Exceptions.
Stefan Vogel <sv@exept.de>
parents:
8681
diff
changeset
|
2409 |
! |
9c00854305f7
QuerySignal generates Notifications instead of Exceptions.
Stefan Vogel <sv@exept.de>
parents:
8681
diff
changeset
|
2410 |
|
6430
9a1580465dd2
better impl. of #deferAfter:
Claus Gittinger <cg@exept.de>
parents:
6426
diff
changeset
|
2411 |
suspendedContext:sContext parameter:aParameter |
8617 | 2412 |
"set required fields |
6430
9a1580465dd2
better impl. of #deferAfter:
Claus Gittinger <cg@exept.de>
parents:
6426
diff
changeset
|
2413 |
- only to be sent from the signal when raising" |
9a1580465dd2
better impl. of #deferAfter:
Claus Gittinger <cg@exept.de>
parents:
6426
diff
changeset
|
2414 |
|
9a1580465dd2
better impl. of #deferAfter:
Claus Gittinger <cg@exept.de>
parents:
6426
diff
changeset
|
2415 |
parameter := aParameter. |
9a1580465dd2
better impl. of #deferAfter:
Claus Gittinger <cg@exept.de>
parents:
6426
diff
changeset
|
2416 |
suspendedContext := sContext. |
9a1580465dd2
better impl. of #deferAfter:
Claus Gittinger <cg@exept.de>
parents:
6426
diff
changeset
|
2417 |
! |
9a1580465dd2
better impl. of #deferAfter:
Claus Gittinger <cg@exept.de>
parents:
6426
diff
changeset
|
2418 |
|
9a1580465dd2
better impl. of #deferAfter:
Claus Gittinger <cg@exept.de>
parents:
6426
diff
changeset
|
2419 |
suspendedContext:sContext parameter:aParameter errorString:aString |
8617 | 2420 |
"set required fields |
6430
9a1580465dd2
better impl. of #deferAfter:
Claus Gittinger <cg@exept.de>
parents:
6426
diff
changeset
|
2421 |
- only to be sent from the signal when raising" |
9a1580465dd2
better impl. of #deferAfter:
Claus Gittinger <cg@exept.de>
parents:
6426
diff
changeset
|
2422 |
|
9a1580465dd2
better impl. of #deferAfter:
Claus Gittinger <cg@exept.de>
parents:
6426
diff
changeset
|
2423 |
parameter := aParameter. |
8313
2aa626e8e404
Fix do not execute an exception handler inside the do-block, when the
Stefan Vogel <sv@exept.de>
parents:
8254
diff
changeset
|
2424 |
messageText := aString. |
6430
9a1580465dd2
better impl. of #deferAfter:
Claus Gittinger <cg@exept.de>
parents:
6426
diff
changeset
|
2425 |
suspendedContext := sContext. |
8684
9c00854305f7
QuerySignal generates Notifications instead of Exceptions.
Stefan Vogel <sv@exept.de>
parents:
8681
diff
changeset
|
2426 |
! |
9c00854305f7
QuerySignal generates Notifications instead of Exceptions.
Stefan Vogel <sv@exept.de>
parents:
8681
diff
changeset
|
2427 |
|
9c00854305f7
QuerySignal generates Notifications instead of Exceptions.
Stefan Vogel <sv@exept.de>
parents:
8681
diff
changeset
|
2428 |
suspendedContext:aContext parameter:aParameter originator:anOriginator |
9c00854305f7
QuerySignal generates Notifications instead of Exceptions.
Stefan Vogel <sv@exept.de>
parents:
8681
diff
changeset
|
2429 |
suspendedContext := aContext. |
9c00854305f7
QuerySignal generates Notifications instead of Exceptions.
Stefan Vogel <sv@exept.de>
parents:
8681
diff
changeset
|
2430 |
parameter := aParameter. |
9c00854305f7
QuerySignal generates Notifications instead of Exceptions.
Stefan Vogel <sv@exept.de>
parents:
8681
diff
changeset
|
2431 |
originator := anOriginator. |
4481
f3f7e1af7489
added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2432 |
! ! |
f3f7e1af7489
added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2433 |
|
6220 | 2434 |
!GenericException methodsFor:'testing'! |
2435 |
||
8065
23355398af34
isOpenError, isStreamError and isError queries added
Claus Gittinger <cg@exept.de>
parents:
7808
diff
changeset
|
2436 |
isError |
23355398af34
isOpenError, isStreamError and isError queries added
Claus Gittinger <cg@exept.de>
parents:
7808
diff
changeset
|
2437 |
^ false |
23355398af34
isOpenError, isStreamError and isError queries added
Claus Gittinger <cg@exept.de>
parents:
7808
diff
changeset
|
2438 |
! |
23355398af34
isOpenError, isStreamError and isError queries added
Claus Gittinger <cg@exept.de>
parents:
7808
diff
changeset
|
2439 |
|
6220 | 2440 |
isException |
2441 |
^ true |
|
2442 |
||
2443 |
"Created: / 17.11.2001 / 18:37:27 / cg" |
|
8681
38aa963476a5
Support for Block>>#on:do:on:do:
Stefan Vogel <sv@exept.de>
parents:
8677
diff
changeset
|
2444 |
! |
38aa963476a5
Support for Block>>#on:do:on:do:
Stefan Vogel <sv@exept.de>
parents:
8677
diff
changeset
|
2445 |
|
38aa963476a5
Support for Block>>#on:do:on:do:
Stefan Vogel <sv@exept.de>
parents:
8677
diff
changeset
|
2446 |
isNotification |
38aa963476a5
Support for Block>>#on:do:on:do:
Stefan Vogel <sv@exept.de>
parents:
8677
diff
changeset
|
2447 |
^ false |
20436 | 2448 |
! |
2449 |
||
2450 |
isProgramError |
|
2451 |
"redefined in all exceptions which are programmer's errors, |
|
2452 |
and which should probably not be ignored. |
|
2453 |
I.e. a global error handler should reject and let a debugger get control." |
|
2454 |
||
2455 |
^ self class isProgramError |
|
6220 | 2456 |
! ! |
2457 |
||
4481
f3f7e1af7489
added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2458 |
!GenericException class methodsFor:'documentation'! |
f3f7e1af7489
added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2459 |
|
f3f7e1af7489
added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2460 |
version |
18727 | 2461 |
^ '$Header$' |
12059 | 2462 |
! |
2463 |
||
2464 |
version_CVS |
|
18727 | 2465 |
^ '$Header$' |
4481
f3f7e1af7489
added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2466 |
! ! |
6859
5ef85865e8db
Print exception description with #printOn:
Stefan Vogel <sv@exept.de>
parents:
6630
diff
changeset
|
2467 |
|
14962 | 2468 |
|
4481
f3f7e1af7489
added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2469 |
GenericException initialize! |