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