author | Stefan Vogel <sv@exept.de> |
Tue, 29 Jul 2008 14:35:42 +0200 | |
changeset 11100 | c9ec12ef4b3b |
parent 10731 | c4945a13d5d9 |
child 11233 | 4c35e5414ddf |
permissions | -rw-r--r-- |
4554 | 1 |
" |
2 |
COPYRIGHT (c) 1999 by eXept Software AG |
|
3 |
All Rights Reserved |
|
4 |
||
5 |
This software is furnished under a license and may be used |
|
6 |
only in accordance with the terms of that license and with the |
|
7 |
inclusion of the above copyright notice. This software may not |
|
8 |
be provided or otherwise made available to, or used by, any |
|
9 |
other person. No title to or ownership of the software is |
|
10 |
hereby transferred. |
|
11 |
" |
|
6210
d7039e2ae776
caetgory change and documentation added
Claus Gittinger <cg@exept.de>
parents:
5295
diff
changeset
|
12 |
"{ Package: 'stx:libbasic' }" |
d7039e2ae776
caetgory change and documentation added
Claus Gittinger <cg@exept.de>
parents:
5295
diff
changeset
|
13 |
|
8955 | 14 |
GenericException subclass:#NoHandlerError |
4528 | 15 |
instanceVariableNames:'' |
16 |
classVariableNames:'EmergencyHandler' |
|
17 |
poolDictionaries:'' |
|
6210
d7039e2ae776
caetgory change and documentation added
Claus Gittinger <cg@exept.de>
parents:
5295
diff
changeset
|
18 |
category:'Kernel-Exceptions-Errors' |
4528 | 19 |
! |
20 |
||
21 |
!NoHandlerError class methodsFor:'documentation'! |
|
22 |
||
4554 | 23 |
copyright |
24 |
" |
|
25 |
COPYRIGHT (c) 1999 by eXept Software AG |
|
26 |
All Rights Reserved |
|
27 |
||
28 |
This software is furnished under a license and may be used |
|
29 |
only in accordance with the terms of that license and with the |
|
30 |
inclusion of the above copyright notice. This software may not |
|
31 |
be provided or otherwise made available to, or used by, any |
|
32 |
other person. No title to or ownership of the software is |
|
33 |
hereby transferred. |
|
34 |
" |
|
35 |
||
36 |
||
37 |
! |
|
38 |
||
4528 | 39 |
documentation |
40 |
" |
|
41 |
NoHandlerError is raised, if there is no exception handler |
|
42 |
or default action for an exception. |
|
43 |
||
44 |
The parameter is the unhandled exception. |
|
4554 | 45 |
|
46 |
[Class variables:] |
|
47 |
EmergencyHandler <Block> this block is evaluated, if no handler was defined |
|
48 |
for a signal (i.e. this one is responsible for the |
|
49 |
unhandled exception debugger). |
|
50 |
Having this being a block allows to globally catch |
|
51 |
these errors - even when no enclosing handler-scope |
|
52 |
around the erronous code exists. |
|
53 |
(as the catch/through does). |
|
54 |
||
55 |
||
56 |
[see also:] |
|
57 |
GenericException |
|
58 |
(``Exception handling and signals'': programming/exceptions.html) |
|
4528 | 59 |
" |
60 |
||
61 |
||
4554 | 62 |
! |
63 |
||
64 |
examples |
|
65 |
" |
|
66 |
The emergencyHandler stuff is very useful, to prevent endUser applications |
|
67 |
from entering the debugger. |
|
68 |
||
69 |
Some commonly used (useful) emergency handlers are provided in the |
|
70 |
'useful handlers' section; try them to learn more |
|
71 |
(especially, the mailingHandler is fun). |
|
72 |
||
73 |
Of course, these are only examples - you may define your own handler |
|
74 |
block and pass it to the #emergencyHandler: method. |
|
75 |
||
76 |
BTW: the Launchers 'source & debugger' settings menu allows you |
|
77 |
to install either a default or the notifying handler. |
|
78 |
||
79 |
||
80 |
A handler which shows a box, then aborts - (no more debuggers): |
|
81 |
[exBegin] |
|
82 |
NoHandlerError emergencyHandler:(NoHandlerError abortingEmergencyHandler) |
|
83 |
[exEnd] |
|
84 |
||
85 |
||
86 |
A handler which aborts - (no box, no debugger): |
|
87 |
[exBegin] |
|
88 |
NoHandlerError emergencyHandler:[:ex | AbortSignal raise] |
|
89 |
[exEnd] |
|
90 |
||
91 |
||
92 |
try some exception (for demonstration, in some other process): |
|
93 |
[exBegin] |
|
94 |
[ |
|
95 |
#(1 2 3) at:4 |
|
96 |
] fork. |
|
97 |
[exEnd] |
|
98 |
||
99 |
cleanup (switch back to the regular handler, which enters the debugger): |
|
100 |
[exBegin] |
|
101 |
NoHandlerError emergencyHandler:nil |
|
102 |
[exEnd] |
|
103 |
||
104 |
||
105 |
A handler which shows a warnBox and asks for debugging: |
|
106 |
[exBegin] |
|
107 |
NoHandlerError emergencyHandler:(NoHandlerError notifyingEmergencyHandler) |
|
108 |
[exEnd] |
|
109 |
||
110 |
||
111 |
||
112 |
A handler which dumps information to a file (watch the file 'errorTrace.stx'): |
|
113 |
[exBegin] |
|
114 |
NoHandlerError emergencyHandler:(NoHandlerError dumpingEmergencyHandler) |
|
115 |
[exEnd] |
|
116 |
||
117 |
||
118 |
||
119 |
A handler which sends you mail: |
|
120 |
[exBegin] |
|
121 |
NoHandlerError emergencyHandler:(NoHandlerError mailingEmergencyHandler) |
|
122 |
[exEnd] |
|
123 |
" |
|
124 |
||
4528 | 125 |
! ! |
126 |
||
127 |
!NoHandlerError class methodsFor:'initialization'! |
|
128 |
||
129 |
initialize |
|
130 |
||
131 |
NotifierString := 'unhandled exception'. |
|
132 |
||
133 |
" |
|
134 |
self initialize |
|
135 |
" |
|
136 |
||
137 |
||
138 |
! ! |
|
139 |
||
8678 | 140 |
!NoHandlerError class methodsFor:'accessing emergencyHandler'! |
4528 | 141 |
|
142 |
emergencyHandler |
|
143 |
"return the handler used for unhandled exceptions. |
|
144 |
||
145 |
If no EmergencyHandler has been set, a handler which enters the |
|
146 |
debugger is returned. |
|
147 |
The debugger is opened by asking the signal for a debug action, |
|
148 |
this allows to provide other debuggers in specialized (subclass-instances) |
|
149 |
of Signal (if that is ever needed)" |
|
150 |
||
151 |
" |
|
152 |
set it up, when called the first time |
|
153 |
" |
|
154 |
EmergencyHandler isNil ifTrue:[ |
|
155 |
EmergencyHandler := [:ex | |
|
156 |
" |
|
157 |
sending it to the signal allows per-signal specific |
|
158 |
debuggers to be implemented in the future |
|
159 |
(for example, segv in primitive code could show things |
|
160 |
on the C-level ..) |
|
161 |
" |
|
8678 | 162 |
ex signal openDebuggerOnException:ex. |
163 |
||
164 |
"if we arrive here, the debugger did proceed. |
|
165 |
the value returned by #openDebuggerOnException: is the exceptions value ..." |
|
4528 | 166 |
] |
167 |
]. |
|
168 |
||
169 |
^ EmergencyHandler |
|
170 |
! |
|
171 |
||
172 |
emergencyHandler:aOneArgBlock |
|
173 |
"set the handler used for unhandled exceptions. |
|
174 |
The default (a nil-handler) leads to a debugger to be shown." |
|
175 |
||
176 |
EmergencyHandler := aOneArgBlock |
|
177 |
||
178 |
"ST-80 behavior of first showing a notifier: |
|
179 |
(I prefer to get right into the debugger, though) |
|
180 |
||
8678 | 181 |
NoHandlerError |
4528 | 182 |
emergencyHandler: |
8678 | 183 |
[:ex | self errorNotify:ex description ] |
4528 | 184 |
" |
185 |
||
186 |
"ST-X behavior of going right into the debugger: |
|
187 |
||
8678 | 188 |
NoHandlerError |
4528 | 189 |
emergencyHandler:nil |
190 |
" |
|
191 |
||
192 |
"automatically aborting current operation, on error: |
|
193 |
(may be useful for end-user apps; make certain, |
|
194 |
you have abortSignal handlers at appropriate places) |
|
195 |
||
8678 | 196 |
NoHandlerError |
4528 | 197 |
emergencyHandler: |
8678 | 198 |
[:ex | AbortOperationRequest raise. ex return. ] |
4528 | 199 |
" |
200 |
||
201 |
"finally, traditional language system behavior; dump core ;-) |
|
202 |
||
8678 | 203 |
NoHandlerError |
4528 | 204 |
emergencyHandler: |
205 |
[:ex | Smalltalk exitWithCoreDump. ] |
|
206 |
" |
|
207 |
||
208 |
"Modified: 15.1.1997 / 20:49:06 / cg" |
|
8678 | 209 |
! ! |
4528 | 210 |
|
8678 | 211 |
!NoHandlerError class methodsFor:'useful emergency handlers'! |
212 |
||
213 |
abortingEmergencyHandler |
|
214 |
"return a block (usable as an emergency handler), |
|
215 |
which aborts after showing a warnBox. |
|
216 |
This is useful for endUser applications." |
|
217 |
||
218 |
^ [:ex | self warn:'Error: ' , ex description. |
|
219 |
AbortOperationRequest raise |
|
220 |
] |
|
221 |
||
222 |
"test with (try a few halts or CTRL-C's): |
|
223 |
NoHandlerError emergencyHandler:(NoHandlerError abortingEmergencyHandler) |
|
224 |
" |
|
225 |
||
226 |
"back with: |
|
227 |
NoHandlerError emergencyHandler:(NoHandlerError notifyingEmergencyHandler) |
|
228 |
NoHandlerError emergencyHandler:nil |
|
229 |
" |
|
230 |
||
231 |
"Created: 15.1.1997 / 20:13:06 / cg" |
|
232 |
"Modified: 15.1.1997 / 20:15:02 / cg" |
|
233 |
! |
|
234 |
||
235 |
dumpingEmergencyHandler |
|
236 |
"return a block (usable as an emergency handler), |
|
237 |
which dumps the stackBacktrace to a trace file and |
|
238 |
aborts after showing a warnBox. |
|
239 |
This is useful, for endUser application, which are still being |
|
240 |
debugged (i.e. the programmers may have a look at the traceFile |
|
241 |
from time to time). |
|
242 |
||
243 |
Notice: |
|
244 |
The code below is just an example; you may want to change the |
|
245 |
name of the error-file in your application |
|
246 |
(but please: copy the code; do not modify here)" |
|
247 |
||
248 |
^ [:ex | |
|
249 |
|str printedException| |
|
250 |
||
251 |
ex signal == NoHandlerError ifTrue:[ |
|
252 |
printedException := ex unhandledException. |
|
253 |
] ifFalse:[ |
|
254 |
printedException := ex |
|
255 |
]. |
|
256 |
||
257 |
"/ user interruption is handled specially: |
|
258 |
"/ allow user to choose between proceeding or aborting |
|
259 |
"/ but never dump that information to the file. |
|
260 |
||
261 |
printedException signal == Object userInterruptSignal ifTrue:[ |
|
262 |
(self confirm:'abort current action ?') ifTrue:[ |
|
263 |
AbortOperationRequest raise |
|
264 |
]. |
|
265 |
ex proceedWith:nil |
|
266 |
]. |
|
267 |
||
268 |
"/ |
|
269 |
"/ dump it to 'errorTrace.stx' |
|
270 |
"/ |
|
271 |
str := 'errorTrace.stx' asFilename appendingWriteStream. |
|
272 |
||
273 |
str nextPutLine:('******************************* ' |
|
274 |
, Timestamp now printString |
|
275 |
, ' *******************************'). |
|
276 |
str cr. |
|
277 |
||
278 |
str nextPutLine:('** Error: ' , printedException description). |
|
279 |
str nextPutLine:('** Signal: ' , printedException signal printString). |
|
280 |
str nextPutLine:('** Parameter: ' , printedException parameter printString). |
|
281 |
str nextPutLine:('** Process: ' , Processor activeProcess printString). |
|
282 |
str nextPutLine:('** Backtrace:'). |
|
283 |
str cr. |
|
284 |
||
285 |
printedException suspendedContext fullPrintAllOn:str. |
|
286 |
str cr. |
|
287 |
str cr. |
|
288 |
str close. |
|
289 |
||
290 |
"/ send a line to stdErr |
|
291 |
||
292 |
('[warning]: ignored error: ' , printedException description) errorPrintCR. |
|
293 |
('[warning]: error information appended to ''errorTrace.stx''') errorPrintCR. |
|
294 |
||
295 |
AbortOperationRequest raise |
|
296 |
] |
|
297 |
||
298 |
"test with (try a few halts or CTRL-C's): |
|
299 |
NoHandlerError emergencyHandler:(NoHandlerError dumpingEmergencyHandler) |
|
300 |
" |
|
301 |
||
302 |
"back with: |
|
303 |
NoHandlerError emergencyHandler:(NoHandlerError notifyingEmergencyHandler) |
|
304 |
NoHandlerError emergencyHandler:nil |
|
305 |
" |
|
306 |
||
307 |
"Created: / 15.1.1997 / 20:14:52 / cg" |
|
308 |
"Modified: / 24.1.1997 / 20:36:21 / cg" |
|
309 |
"Modified: / 4.8.1999 / 08:11:20 / stefan" |
|
310 |
! |
|
311 |
||
312 |
mailingEmergencyHandler |
|
313 |
"return a block (usable as an emergency handler), |
|
314 |
which shows a warnBox and optionally mails a stackBacktrace to a maintainer. |
|
315 |
This is useful, for endUser application, which are still being |
|
316 |
debugged (i.e. the programmers may have a look at the errors). |
|
317 |
||
318 |
Notice: the stuff here is a demonstration only; it should be modified |
|
319 |
for your particular environment ... |
|
320 |
... but please: copy the code and modify there; |
|
321 |
leave the stuff below as it is." |
|
322 |
||
323 |
^ [:ex | |
|
324 |
|str printedException doMail emergencyMailReceiver pipe| |
|
325 |
||
326 |
ex signal == NoHandlerError ifTrue:[ |
|
327 |
printedException := ex unhandledException. |
|
328 |
] ifFalse:[ |
|
329 |
printedException := ex |
|
330 |
]. |
|
331 |
||
332 |
"/ user interruption is handled specially: |
|
333 |
"/ allow user to choose between proceeding or aborting |
|
334 |
"/ but never dump that information to the file. |
|
335 |
||
336 |
printedException signal == UserInterrupt ifTrue:[ |
|
337 |
(self confirm:'abort current action ?') ifTrue:[ |
|
338 |
AbortOperationRequest raise |
|
339 |
]. |
|
340 |
ex proceedWith:nil |
|
341 |
]. |
|
342 |
||
343 |
"/ somehow get the name of the guy to receive the mail |
|
344 |
"/ you have to implement that yourself. |
|
345 |
||
346 |
"/ emergencyMailReceiver := OneOfYourClass getEmergencyMailReceiver. |
|
347 |
emergencyMailReceiver := OperatingSystem getLoginName. |
|
348 |
||
349 |
emergencyMailReceiver isNil ifTrue:[ |
|
350 |
self warn:(printedException description |
|
351 |
, '\\No mailing to service people possible.') withCRs. |
|
352 |
doMail := false. |
|
353 |
] ifFalse:[ |
|
354 |
doMail := self confirm:(printedException description |
|
355 |
, '\\Mail error information to the service people (' |
|
356 |
, emergencyMailReceiver , ') ?') withCRs |
|
357 |
]. |
|
358 |
doMail ifTrue:[ |
|
359 |
str := '' writeStream. |
|
360 |
||
361 |
str nextPutLine:('Error notification from ' |
|
362 |
, OperatingSystem getLoginName |
|
363 |
, '@' |
|
364 |
, OperatingSystem getHostName). |
|
365 |
str cr. |
|
366 |
||
367 |
str nextPutLine:('Time: ' , Timestamp now printString). |
|
368 |
str nextPutLine:('Error: ', printedException description). |
|
369 |
str nextPutLine:('Signal: ', printedException signal printString). |
|
370 |
str nextPutLine:('Parameter: ', printedException parameter printString). |
|
371 |
str nextPutLine:('Process: ', Processor activeProcess printString). |
|
372 |
str nextPutLine:'Backtrace:'. |
|
373 |
str cr. |
|
374 |
||
375 |
printedException suspendedContext fullPrintAllOn:str. |
|
376 |
str cr;cr. |
|
377 |
||
378 |
str close. |
|
379 |
||
380 |
pipe := PipeStream |
|
381 |
writingTo:'mail ', emergencyMailReceiver. |
|
382 |
pipe notNil ifTrue:[ |
|
383 |
pipe nextPutLine:'Subject: automatic error report'. |
|
384 |
pipe nextPutAll:str contents. |
|
385 |
pipe cr. |
|
386 |
pipe close. |
|
387 |
] |
|
388 |
]. |
|
389 |
||
390 |
AbortOperationRequest raise. |
|
391 |
"not reached" |
|
392 |
] |
|
393 |
||
394 |
"test with (try a few halts or CTRL-C's): |
|
395 |
NoHandlerError emergencyHandler:(NoHandlerError mailingEmergencyHandler) |
|
396 |
" |
|
397 |
||
398 |
"back with: |
|
399 |
NoHandlerError emergencyHandler:(NoHandlerError notifyingEmergencyHandler) |
|
400 |
NoHandlerError emergencyHandler:nil |
|
401 |
" |
|
402 |
||
403 |
"Created: / 15.1.1997 / 20:14:52 / cg" |
|
404 |
"Modified: / 15.1.1997 / 21:10:28 / cg" |
|
405 |
"Modified: / 4.8.1999 / 08:11:26 / stefan" |
|
406 |
! |
|
407 |
||
408 |
notifyingEmergencyHandler |
|
409 |
"return a block (usable as an emergency handler for exceptions), |
|
410 |
which does errorNotification before going into the debugger. |
|
411 |
Halts and breakpoints go directly into the debugger (without asking)" |
|
412 |
||
413 |
^ [:ex | |
|
414 |
(ex signal == NoHandlerError |
|
9273
3ef50bca3bf4
inheritsFrom: should not be used/redefined in the exception
Claus Gittinger <cg@exept.de>
parents:
8955
diff
changeset
|
415 |
and:[ (ControlInterrupt accepts:ex unhandledException signal) |
3ef50bca3bf4
inheritsFrom: should not be used/redefined in the exception
Claus Gittinger <cg@exept.de>
parents:
8955
diff
changeset
|
416 |
and:[ (ControlInterrupt ~~ ex unhandledException signal) ]]) ifTrue:[ |
8678 | 417 |
"/ go directly into the debugger ... |
418 |
^ Debugger |
|
9994
2dcde06ef1fc
When opening a debugger, make sure that the topmost context is returnable
Stefan Vogel <sv@exept.de>
parents:
9273
diff
changeset
|
419 |
enter:ex returnableSuspendedContext |
8678 | 420 |
withMessage:ex description |
421 |
mayProceed:true |
|
9273
3ef50bca3bf4
inheritsFrom: should not be used/redefined in the exception
Claus Gittinger <cg@exept.de>
parents:
8955
diff
changeset
|
422 |
]. |
3ef50bca3bf4
inheritsFrom: should not be used/redefined in the exception
Claus Gittinger <cg@exept.de>
parents:
8955
diff
changeset
|
423 |
"/ ask, and maybe go into the debugger ... |
3ef50bca3bf4
inheritsFrom: should not be used/redefined in the exception
Claus Gittinger <cg@exept.de>
parents:
8955
diff
changeset
|
424 |
^ nil |
3ef50bca3bf4
inheritsFrom: should not be used/redefined in the exception
Claus Gittinger <cg@exept.de>
parents:
8955
diff
changeset
|
425 |
errorNotify:ex description |
9994
2dcde06ef1fc
When opening a debugger, make sure that the topmost context is returnable
Stefan Vogel <sv@exept.de>
parents:
9273
diff
changeset
|
426 |
from:ex returnableSuspendedContext |
9273
3ef50bca3bf4
inheritsFrom: should not be used/redefined in the exception
Claus Gittinger <cg@exept.de>
parents:
8955
diff
changeset
|
427 |
allowDebug:true |
8678 | 428 |
] |
429 |
||
430 |
"test with (NOTE: halt, breakpoints or CTRL-C's still go straight into the debugger): |
|
431 |
NoHandlerError emergencyHandler:(NoHandlerError notifyingEmergencyHandler). |
|
432 |
Object bla. |
|
433 |
" |
|
434 |
||
435 |
"back with: |
|
436 |
NoHandlerError emergencyHandler:nil |
|
437 |
" |
|
438 |
||
439 |
"Modified: / 16.11.2001 / 16:07:05 / cg" |
|
440 |
! |
|
441 |
||
442 |
notifyingEmergencyHandlerForUserProcesses |
|
443 |
"return a block (usable as an emergency handler for exceptions), |
|
444 |
which does errorNotification before going into the debugger, |
|
445 |
but only for exceptions occurring in user processes; |
|
446 |
systemProcesses are not debugged. |
|
447 |
Halts and breakpoints go directly into the debugger (without asking)" |
|
448 |
||
449 |
^ [:ex | |
|
450 |
||
451 |
|theException| |
|
452 |
||
453 |
Processor activeProcessIsSystemProcess ifTrue:[ |
|
454 |
'EmergencyHandler [info]: exception cought: ' errorPrint. |
|
455 |
ex signal == NoHandlerError ifTrue:[ |
|
456 |
theException := ex unhandledException. |
|
457 |
] ifFalse:[ |
|
458 |
theException := ex |
|
459 |
]. |
|
460 |
theException description errorPrintCR. |
|
461 |
AbortOperationRequest raise. |
|
462 |
] ifFalse:[ |
|
463 |
(ex signal == NoHandlerError |
|
9273
3ef50bca3bf4
inheritsFrom: should not be used/redefined in the exception
Claus Gittinger <cg@exept.de>
parents:
8955
diff
changeset
|
464 |
and:[ (ControlInterrupt accepts:ex unhandledException signal) |
3ef50bca3bf4
inheritsFrom: should not be used/redefined in the exception
Claus Gittinger <cg@exept.de>
parents:
8955
diff
changeset
|
465 |
and:[ (ControlInterrupt ~~ ex unhandledException signal) ]]) ifTrue:[ |
8678 | 466 |
"/ go directly into the debugger ... |
467 |
^ Debugger |
|
9994
2dcde06ef1fc
When opening a debugger, make sure that the topmost context is returnable
Stefan Vogel <sv@exept.de>
parents:
9273
diff
changeset
|
468 |
enter:ex returnableSuspendedContext |
8678 | 469 |
withMessage:ex description |
470 |
mayProceed:true |
|
9273
3ef50bca3bf4
inheritsFrom: should not be used/redefined in the exception
Claus Gittinger <cg@exept.de>
parents:
8955
diff
changeset
|
471 |
]. |
3ef50bca3bf4
inheritsFrom: should not be used/redefined in the exception
Claus Gittinger <cg@exept.de>
parents:
8955
diff
changeset
|
472 |
"/ ask, and maybe go into the debugger ... |
3ef50bca3bf4
inheritsFrom: should not be used/redefined in the exception
Claus Gittinger <cg@exept.de>
parents:
8955
diff
changeset
|
473 |
^ nil |
3ef50bca3bf4
inheritsFrom: should not be used/redefined in the exception
Claus Gittinger <cg@exept.de>
parents:
8955
diff
changeset
|
474 |
errorNotify:ex description |
9994
2dcde06ef1fc
When opening a debugger, make sure that the topmost context is returnable
Stefan Vogel <sv@exept.de>
parents:
9273
diff
changeset
|
475 |
from:ex returnableSuspendedContext |
9273
3ef50bca3bf4
inheritsFrom: should not be used/redefined in the exception
Claus Gittinger <cg@exept.de>
parents:
8955
diff
changeset
|
476 |
allowDebug:true |
8678 | 477 |
] |
478 |
] |
|
479 |
||
480 |
"test with: |
|
481 |
NoHandlerError emergencyHandler:(NoHandlerError notifyingEmergencyHandlerForUserProcesses) |
|
482 |
Object bla. |
|
483 |
" |
|
484 |
||
485 |
"back with: |
|
486 |
NoHandlerError emergencyHandler:nil |
|
487 |
" |
|
488 |
||
489 |
"Modified: / 16.11.2001 / 16:06:54 / cg" |
|
490 |
! ! |
|
491 |
||
492 |
!NoHandlerError methodsFor:'accessing'! |
|
493 |
||
494 |
unhandledException |
|
495 |
^ parameter |
|
4528 | 496 |
! ! |
497 |
||
498 |
!NoHandlerError methodsFor:'default actions'! |
|
499 |
||
500 |
defaultAction |
|
501 |
"This action is performed, if nobody handles the NoHandlerError. |
|
502 |
Look for either a per-process emergencyHandlerBlock |
|
10731 | 503 |
or the global emergencyHandler ..." |
4528 | 504 |
|
505 |
|block| |
|
506 |
||
507 |
Processor notNil ifTrue:[ |
|
508 |
"care for signal during startup (Processor not yet created)" |
|
509 |
block := Processor activeProcess emergencySignalHandler. |
|
510 |
]. |
|
511 |
block isNil ifTrue:[ |
|
512 |
block := self class emergencyHandler. |
|
513 |
block isNil ifTrue:[ |
|
514 |
"care for error during startup (Exception not yet initialized)" |
|
4539
7064506e8285
debugger entry protocol changed;
Claus Gittinger <cg@exept.de>
parents:
4528
diff
changeset
|
515 |
^ MiniDebugger |
5295 | 516 |
enterWithMessage:self description |
4539
7064506e8285
debugger entry protocol changed;
Claus Gittinger <cg@exept.de>
parents:
4528
diff
changeset
|
517 |
mayProceed:self mayProceed |
4528 | 518 |
]. |
519 |
]. |
|
520 |
||
4586
22c84f7f9b85
return nil from raise if proceeded in the debugger
Claus Gittinger <cg@exept.de>
parents:
4561
diff
changeset
|
521 |
^ block value:self |
4561 | 522 |
! |
523 |
||
524 |
noHandler |
|
525 |
"redefined to avoid recursive invocations" |
|
526 |
||
527 |
^ self |
|
4528 | 528 |
! ! |
529 |
||
4539
7064506e8285
debugger entry protocol changed;
Claus Gittinger <cg@exept.de>
parents:
4528
diff
changeset
|
530 |
!NoHandlerError methodsFor:'queries'! |
7064506e8285
debugger entry protocol changed;
Claus Gittinger <cg@exept.de>
parents:
4528
diff
changeset
|
531 |
|
7064506e8285
debugger entry protocol changed;
Claus Gittinger <cg@exept.de>
parents:
4528
diff
changeset
|
532 |
mayProceed |
7064506e8285
debugger entry protocol changed;
Claus Gittinger <cg@exept.de>
parents:
4528
diff
changeset
|
533 |
"return true, if the exception handler is allowed to proceed |
7064506e8285
debugger entry protocol changed;
Claus Gittinger <cg@exept.de>
parents:
4528
diff
changeset
|
534 |
the execution where the exception occured." |
7064506e8285
debugger entry protocol changed;
Claus Gittinger <cg@exept.de>
parents:
4528
diff
changeset
|
535 |
|
10731 | 536 |
^ parameter isNil or:[parameter mayProceed]. |
4539
7064506e8285
debugger entry protocol changed;
Claus Gittinger <cg@exept.de>
parents:
4528
diff
changeset
|
537 |
! ! |
7064506e8285
debugger entry protocol changed;
Claus Gittinger <cg@exept.de>
parents:
4528
diff
changeset
|
538 |
|
4528 | 539 |
!NoHandlerError class methodsFor:'documentation'! |
540 |
||
541 |
version |
|
10731 | 542 |
^ '$Header: /cvs/stx/stx/libbasic/NoHandlerError.st,v 1.16 2007-10-01 07:40:01 stefan Exp $' |
4528 | 543 |
! ! |
7586 | 544 |
|
4528 | 545 |
NoHandlerError initialize! |