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