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