author | Claus Gittinger <cg@exept.de> |
Sun, 14 Jun 2009 11:27:39 +0200 | |
changeset 11772 | a220d63dfc64 |
parent 11303 | 48759a62953b |
child 12790 | 1d1ebb922d13 |
child 17711 | 39faaaf888b4 |
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 | |
|
11233
4c35e5414ddf
got rid of the \"unhandled...(\" prefix in the debugger;
Claus Gittinger <cg@exept.de>
parents:
10731
diff
changeset
|
414 |
|message| |
4c35e5414ddf
got rid of the \"unhandled...(\" prefix in the debugger;
Claus Gittinger <cg@exept.de>
parents:
10731
diff
changeset
|
415 |
|
4c35e5414ddf
got rid of the \"unhandled...(\" prefix in the debugger;
Claus Gittinger <cg@exept.de>
parents:
10731
diff
changeset
|
416 |
message := ex descriptionForDebugger. |
4c35e5414ddf
got rid of the \"unhandled...(\" prefix in the debugger;
Claus Gittinger <cg@exept.de>
parents:
10731
diff
changeset
|
417 |
|
8678 | 418 |
(ex signal == NoHandlerError |
11303
48759a62953b
clean up #notifyingEmegencyHandler
Stefan Vogel <sv@exept.de>
parents:
11233
diff
changeset
|
419 |
and:[(ControlInterrupt handles:ex unhandledException) |
48759a62953b
clean up #notifyingEmegencyHandler
Stefan Vogel <sv@exept.de>
parents:
11233
diff
changeset
|
420 |
and:[(ControlInterrupt ~~ ex unhandledException signal) ]]) ifTrue:[ |
8678 | 421 |
"/ go directly into the debugger ... |
422 |
^ Debugger |
|
9994
2dcde06ef1fc
When opening a debugger, make sure that the topmost context is returnable
Stefan Vogel <sv@exept.de>
parents:
9273
diff
changeset
|
423 |
enter:ex returnableSuspendedContext |
11233
4c35e5414ddf
got rid of the \"unhandled...(\" prefix in the debugger;
Claus Gittinger <cg@exept.de>
parents:
10731
diff
changeset
|
424 |
withMessage:message |
8678 | 425 |
mayProceed:true |
9273
3ef50bca3bf4
inheritsFrom: should not be used/redefined in the exception
Claus Gittinger <cg@exept.de>
parents:
8955
diff
changeset
|
426 |
]. |
3ef50bca3bf4
inheritsFrom: should not be used/redefined in the exception
Claus Gittinger <cg@exept.de>
parents:
8955
diff
changeset
|
427 |
"/ 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
|
428 |
^ nil |
11233
4c35e5414ddf
got rid of the \"unhandled...(\" prefix in the debugger;
Claus Gittinger <cg@exept.de>
parents:
10731
diff
changeset
|
429 |
errorNotify:message |
9994
2dcde06ef1fc
When opening a debugger, make sure that the topmost context is returnable
Stefan Vogel <sv@exept.de>
parents:
9273
diff
changeset
|
430 |
from:ex returnableSuspendedContext |
9273
3ef50bca3bf4
inheritsFrom: should not be used/redefined in the exception
Claus Gittinger <cg@exept.de>
parents:
8955
diff
changeset
|
431 |
allowDebug:true |
8678 | 432 |
] |
433 |
||
434 |
"test with (NOTE: halt, breakpoints or CTRL-C's still go straight into the debugger): |
|
435 |
NoHandlerError emergencyHandler:(NoHandlerError notifyingEmergencyHandler). |
|
436 |
Object bla. |
|
437 |
" |
|
438 |
||
439 |
"back with: |
|
440 |
NoHandlerError emergencyHandler:nil |
|
441 |
" |
|
442 |
||
443 |
"Modified: / 16.11.2001 / 16:07:05 / cg" |
|
444 |
! |
|
445 |
||
446 |
notifyingEmergencyHandlerForUserProcesses |
|
447 |
"return a block (usable as an emergency handler for exceptions), |
|
448 |
which does errorNotification before going into the debugger, |
|
449 |
but only for exceptions occurring in user processes; |
|
450 |
systemProcesses are not debugged. |
|
451 |
Halts and breakpoints go directly into the debugger (without asking)" |
|
452 |
||
453 |
^ [:ex | |
|
454 |
||
11233
4c35e5414ddf
got rid of the \"unhandled...(\" prefix in the debugger;
Claus Gittinger <cg@exept.de>
parents:
10731
diff
changeset
|
455 |
|theException message| |
8678 | 456 |
|
457 |
Processor activeProcessIsSystemProcess ifTrue:[ |
|
458 |
'EmergencyHandler [info]: exception cought: ' errorPrint. |
|
459 |
ex signal == NoHandlerError ifTrue:[ |
|
460 |
theException := ex unhandledException. |
|
461 |
] ifFalse:[ |
|
462 |
theException := ex |
|
463 |
]. |
|
464 |
theException description errorPrintCR. |
|
465 |
AbortOperationRequest raise. |
|
466 |
] ifFalse:[ |
|
11233
4c35e5414ddf
got rid of the \"unhandled...(\" prefix in the debugger;
Claus Gittinger <cg@exept.de>
parents:
10731
diff
changeset
|
467 |
message := ex descriptionForDebugger. |
4c35e5414ddf
got rid of the \"unhandled...(\" prefix in the debugger;
Claus Gittinger <cg@exept.de>
parents:
10731
diff
changeset
|
468 |
|
8678 | 469 |
(ex signal == NoHandlerError |
11303
48759a62953b
clean up #notifyingEmegencyHandler
Stefan Vogel <sv@exept.de>
parents:
11233
diff
changeset
|
470 |
and:[ (ControlInterrupt handles:ex unhandledException) |
9273
3ef50bca3bf4
inheritsFrom: should not be used/redefined in the exception
Claus Gittinger <cg@exept.de>
parents:
8955
diff
changeset
|
471 |
and:[ (ControlInterrupt ~~ ex unhandledException signal) ]]) ifTrue:[ |
8678 | 472 |
"/ go directly into the debugger ... |
473 |
^ Debugger |
|
9994
2dcde06ef1fc
When opening a debugger, make sure that the topmost context is returnable
Stefan Vogel <sv@exept.de>
parents:
9273
diff
changeset
|
474 |
enter:ex returnableSuspendedContext |
11233
4c35e5414ddf
got rid of the \"unhandled...(\" prefix in the debugger;
Claus Gittinger <cg@exept.de>
parents:
10731
diff
changeset
|
475 |
withMessage:message |
8678 | 476 |
mayProceed:true |
9273
3ef50bca3bf4
inheritsFrom: should not be used/redefined in the exception
Claus Gittinger <cg@exept.de>
parents:
8955
diff
changeset
|
477 |
]. |
3ef50bca3bf4
inheritsFrom: should not be used/redefined in the exception
Claus Gittinger <cg@exept.de>
parents:
8955
diff
changeset
|
478 |
"/ 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
|
479 |
^ nil |
11233
4c35e5414ddf
got rid of the \"unhandled...(\" prefix in the debugger;
Claus Gittinger <cg@exept.de>
parents:
10731
diff
changeset
|
480 |
errorNotify:message |
9994
2dcde06ef1fc
When opening a debugger, make sure that the topmost context is returnable
Stefan Vogel <sv@exept.de>
parents:
9273
diff
changeset
|
481 |
from:ex returnableSuspendedContext |
9273
3ef50bca3bf4
inheritsFrom: should not be used/redefined in the exception
Claus Gittinger <cg@exept.de>
parents:
8955
diff
changeset
|
482 |
allowDebug:true |
8678 | 483 |
] |
484 |
] |
|
485 |
||
486 |
"test with: |
|
487 |
NoHandlerError emergencyHandler:(NoHandlerError notifyingEmergencyHandlerForUserProcesses) |
|
488 |
Object bla. |
|
489 |
" |
|
490 |
||
491 |
"back with: |
|
492 |
NoHandlerError emergencyHandler:nil |
|
493 |
" |
|
494 |
||
495 |
"Modified: / 16.11.2001 / 16:06:54 / cg" |
|
496 |
! ! |
|
497 |
||
498 |
!NoHandlerError methodsFor:'accessing'! |
|
499 |
||
500 |
unhandledException |
|
501 |
^ parameter |
|
4528 | 502 |
! ! |
503 |
||
504 |
!NoHandlerError methodsFor:'default actions'! |
|
505 |
||
506 |
defaultAction |
|
507 |
"This action is performed, if nobody handles the NoHandlerError. |
|
508 |
Look for either a per-process emergencyHandlerBlock |
|
10731 | 509 |
or the global emergencyHandler ..." |
4528 | 510 |
|
511 |
|block| |
|
512 |
||
513 |
Processor notNil ifTrue:[ |
|
514 |
"care for signal during startup (Processor not yet created)" |
|
515 |
block := Processor activeProcess emergencySignalHandler. |
|
516 |
]. |
|
517 |
block isNil ifTrue:[ |
|
518 |
block := self class emergencyHandler. |
|
519 |
block isNil ifTrue:[ |
|
520 |
"care for error during startup (Exception not yet initialized)" |
|
4539
7064506e8285
debugger entry protocol changed;
Claus Gittinger <cg@exept.de>
parents:
4528
diff
changeset
|
521 |
^ MiniDebugger |
5295 | 522 |
enterWithMessage:self description |
4539
7064506e8285
debugger entry protocol changed;
Claus Gittinger <cg@exept.de>
parents:
4528
diff
changeset
|
523 |
mayProceed:self mayProceed |
4528 | 524 |
]. |
525 |
]. |
|
526 |
||
4586
22c84f7f9b85
return nil from raise if proceeded in the debugger
Claus Gittinger <cg@exept.de>
parents:
4561
diff
changeset
|
527 |
^ block value:self |
4561 | 528 |
! |
529 |
||
530 |
noHandler |
|
531 |
"redefined to avoid recursive invocations" |
|
532 |
||
533 |
^ self |
|
4528 | 534 |
! ! |
535 |
||
11233
4c35e5414ddf
got rid of the \"unhandled...(\" prefix in the debugger;
Claus Gittinger <cg@exept.de>
parents:
10731
diff
changeset
|
536 |
!NoHandlerError methodsFor:'printing & storing'! |
4c35e5414ddf
got rid of the \"unhandled...(\" prefix in the debugger;
Claus Gittinger <cg@exept.de>
parents:
10731
diff
changeset
|
537 |
|
4c35e5414ddf
got rid of the \"unhandled...(\" prefix in the debugger;
Claus Gittinger <cg@exept.de>
parents:
10731
diff
changeset
|
538 |
descriptionForDebugger |
4c35e5414ddf
got rid of the \"unhandled...(\" prefix in the debugger;
Claus Gittinger <cg@exept.de>
parents:
10731
diff
changeset
|
539 |
"return the description string of the signal which is used in the |
4c35e5414ddf
got rid of the \"unhandled...(\" prefix in the debugger;
Claus Gittinger <cg@exept.de>
parents:
10731
diff
changeset
|
540 |
debugger title area" |
4c35e5414ddf
got rid of the \"unhandled...(\" prefix in the debugger;
Claus Gittinger <cg@exept.de>
parents:
10731
diff
changeset
|
541 |
|
4c35e5414ddf
got rid of the \"unhandled...(\" prefix in the debugger;
Claus Gittinger <cg@exept.de>
parents:
10731
diff
changeset
|
542 |
^ parameter description. |
4c35e5414ddf
got rid of the \"unhandled...(\" prefix in the debugger;
Claus Gittinger <cg@exept.de>
parents:
10731
diff
changeset
|
543 |
! ! |
4c35e5414ddf
got rid of the \"unhandled...(\" prefix in the debugger;
Claus Gittinger <cg@exept.de>
parents:
10731
diff
changeset
|
544 |
|
4539
7064506e8285
debugger entry protocol changed;
Claus Gittinger <cg@exept.de>
parents:
4528
diff
changeset
|
545 |
!NoHandlerError methodsFor:'queries'! |
7064506e8285
debugger entry protocol changed;
Claus Gittinger <cg@exept.de>
parents:
4528
diff
changeset
|
546 |
|
7064506e8285
debugger entry protocol changed;
Claus Gittinger <cg@exept.de>
parents:
4528
diff
changeset
|
547 |
mayProceed |
7064506e8285
debugger entry protocol changed;
Claus Gittinger <cg@exept.de>
parents:
4528
diff
changeset
|
548 |
"return true, if the exception handler is allowed to proceed |
7064506e8285
debugger entry protocol changed;
Claus Gittinger <cg@exept.de>
parents:
4528
diff
changeset
|
549 |
the execution where the exception occured." |
7064506e8285
debugger entry protocol changed;
Claus Gittinger <cg@exept.de>
parents:
4528
diff
changeset
|
550 |
|
10731 | 551 |
^ parameter isNil or:[parameter mayProceed]. |
4539
7064506e8285
debugger entry protocol changed;
Claus Gittinger <cg@exept.de>
parents:
4528
diff
changeset
|
552 |
! ! |
7064506e8285
debugger entry protocol changed;
Claus Gittinger <cg@exept.de>
parents:
4528
diff
changeset
|
553 |
|
4528 | 554 |
!NoHandlerError class methodsFor:'documentation'! |
555 |
||
556 |
version |
|
11303
48759a62953b
clean up #notifyingEmegencyHandler
Stefan Vogel <sv@exept.de>
parents:
11233
diff
changeset
|
557 |
^ '$Header: /cvs/stx/stx/libbasic/NoHandlerError.st,v 1.18 2008-11-01 18:24:05 stefan Exp $' |
4528 | 558 |
! ! |
7586 | 559 |
|
4528 | 560 |
NoHandlerError initialize! |