author | Jan Vrany <jan.vrany@fit.cvut.cz> |
Thu, 19 Jan 2012 10:06:02 +0000 | |
branch | jv |
changeset 17910 | 8d796ca8bd1d |
parent 17892 | d86c8bd5ece3 |
child 17911 | a99f15c5efa5 |
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:[ |
|
17756 | 155 |
EmergencyHandler := |
156 |
[:ex | |
|
157 |
" |
|
158 |
sending it to the signal allows per-signal specific |
|
159 |
debuggers to be implemented in the future |
|
160 |
(for example, segv in primitive code could show things |
|
161 |
on the C-level ..) |
|
162 |
" |
|
163 |
ex signal openDebuggerOnException:ex. |
|
8678 | 164 |
|
17756 | 165 |
"if we arrive here, the debugger did proceed. |
166 |
the value returned by #openDebuggerOnException: is the exceptions value ..." |
|
167 |
] |
|
4528 | 168 |
]. |
169 |
||
170 |
^ EmergencyHandler |
|
17756 | 171 |
|
172 |
" |
|
173 |
NoHandlerError emergencyHandler:[:ex | Transcript showCR:ex description. |
|
174 |
ex signal openDebuggerOnException:ex]. |
|
175 |
" |
|
4528 | 176 |
! |
177 |
||
178 |
emergencyHandler:aOneArgBlock |
|
179 |
"set the handler used for unhandled exceptions. |
|
180 |
The default (a nil-handler) leads to a debugger to be shown." |
|
181 |
||
182 |
EmergencyHandler := aOneArgBlock |
|
183 |
||
184 |
"ST-80 behavior of first showing a notifier: |
|
185 |
(I prefer to get right into the debugger, though) |
|
186 |
||
8678 | 187 |
NoHandlerError |
4528 | 188 |
emergencyHandler: |
8678 | 189 |
[:ex | self errorNotify:ex description ] |
4528 | 190 |
" |
191 |
||
192 |
"ST-X behavior of going right into the debugger: |
|
193 |
||
8678 | 194 |
NoHandlerError |
4528 | 195 |
emergencyHandler:nil |
196 |
" |
|
197 |
||
198 |
"automatically aborting current operation, on error: |
|
199 |
(may be useful for end-user apps; make certain, |
|
200 |
you have abortSignal handlers at appropriate places) |
|
201 |
||
8678 | 202 |
NoHandlerError |
4528 | 203 |
emergencyHandler: |
8678 | 204 |
[:ex | AbortOperationRequest raise. ex return. ] |
4528 | 205 |
" |
206 |
||
207 |
"finally, traditional language system behavior; dump core ;-) |
|
208 |
||
8678 | 209 |
NoHandlerError |
4528 | 210 |
emergencyHandler: |
211 |
[:ex | Smalltalk exitWithCoreDump. ] |
|
212 |
" |
|
213 |
||
214 |
"Modified: 15.1.1997 / 20:49:06 / cg" |
|
8678 | 215 |
! ! |
4528 | 216 |
|
8678 | 217 |
!NoHandlerError class methodsFor:'useful emergency handlers'! |
218 |
||
219 |
abortingEmergencyHandler |
|
220 |
"return a block (usable as an emergency handler), |
|
221 |
which aborts after showing a warnBox. |
|
222 |
This is useful for endUser applications." |
|
223 |
||
224 |
^ [:ex | self warn:'Error: ' , ex description. |
|
225 |
AbortOperationRequest raise |
|
226 |
] |
|
227 |
||
228 |
"test with (try a few halts or CTRL-C's): |
|
229 |
NoHandlerError emergencyHandler:(NoHandlerError abortingEmergencyHandler) |
|
230 |
" |
|
231 |
||
232 |
"back with: |
|
233 |
NoHandlerError emergencyHandler:(NoHandlerError notifyingEmergencyHandler) |
|
234 |
NoHandlerError emergencyHandler:nil |
|
235 |
" |
|
236 |
||
237 |
"Created: 15.1.1997 / 20:13:06 / cg" |
|
238 |
"Modified: 15.1.1997 / 20:15:02 / cg" |
|
239 |
! |
|
240 |
||
241 |
dumpingEmergencyHandler |
|
242 |
"return a block (usable as an emergency handler), |
|
243 |
which dumps the stackBacktrace to a trace file and |
|
244 |
aborts after showing a warnBox. |
|
245 |
This is useful, for endUser application, which are still being |
|
246 |
debugged (i.e. the programmers may have a look at the traceFile |
|
247 |
from time to time). |
|
248 |
||
249 |
Notice: |
|
250 |
The code below is just an example; you may want to change the |
|
251 |
name of the error-file in your application |
|
252 |
(but please: copy the code; do not modify here)" |
|
253 |
||
254 |
^ [:ex | |
|
255 |
|str printedException| |
|
256 |
||
257 |
ex signal == NoHandlerError ifTrue:[ |
|
258 |
printedException := ex unhandledException. |
|
259 |
] ifFalse:[ |
|
260 |
printedException := ex |
|
261 |
]. |
|
262 |
||
263 |
"/ user interruption is handled specially: |
|
264 |
"/ allow user to choose between proceeding or aborting |
|
265 |
"/ but never dump that information to the file. |
|
266 |
||
267 |
printedException signal == Object userInterruptSignal ifTrue:[ |
|
268 |
(self confirm:'abort current action ?') ifTrue:[ |
|
269 |
AbortOperationRequest raise |
|
270 |
]. |
|
271 |
ex proceedWith:nil |
|
272 |
]. |
|
273 |
||
274 |
"/ |
|
275 |
"/ dump it to 'errorTrace.stx' |
|
276 |
"/ |
|
277 |
str := 'errorTrace.stx' asFilename appendingWriteStream. |
|
278 |
||
279 |
str nextPutLine:('******************************* ' |
|
280 |
, Timestamp now printString |
|
281 |
, ' *******************************'). |
|
282 |
str cr. |
|
283 |
||
284 |
str nextPutLine:('** Error: ' , printedException description). |
|
285 |
str nextPutLine:('** Signal: ' , printedException signal printString). |
|
286 |
str nextPutLine:('** Parameter: ' , printedException parameter printString). |
|
287 |
str nextPutLine:('** Process: ' , Processor activeProcess printString). |
|
288 |
str nextPutLine:('** Backtrace:'). |
|
289 |
str cr. |
|
290 |
||
291 |
printedException suspendedContext fullPrintAllOn:str. |
|
292 |
str cr. |
|
293 |
str cr. |
|
294 |
str close. |
|
295 |
||
296 |
"/ send a line to stdErr |
|
297 |
||
298 |
('[warning]: ignored error: ' , printedException description) errorPrintCR. |
|
299 |
('[warning]: error information appended to ''errorTrace.stx''') errorPrintCR. |
|
300 |
||
301 |
AbortOperationRequest raise |
|
302 |
] |
|
303 |
||
304 |
"test with (try a few halts or CTRL-C's): |
|
305 |
NoHandlerError emergencyHandler:(NoHandlerError dumpingEmergencyHandler) |
|
306 |
" |
|
307 |
||
308 |
"back with: |
|
309 |
NoHandlerError emergencyHandler:(NoHandlerError notifyingEmergencyHandler) |
|
310 |
NoHandlerError emergencyHandler:nil |
|
311 |
" |
|
312 |
||
313 |
"Created: / 15.1.1997 / 20:14:52 / cg" |
|
314 |
"Modified: / 24.1.1997 / 20:36:21 / cg" |
|
315 |
"Modified: / 4.8.1999 / 08:11:20 / stefan" |
|
316 |
! |
|
317 |
||
318 |
mailingEmergencyHandler |
|
319 |
"return a block (usable as an emergency handler), |
|
320 |
which shows a warnBox and optionally mails a stackBacktrace to a maintainer. |
|
321 |
This is useful, for endUser application, which are still being |
|
322 |
debugged (i.e. the programmers may have a look at the errors). |
|
323 |
||
324 |
Notice: the stuff here is a demonstration only; it should be modified |
|
325 |
for your particular environment ... |
|
326 |
... but please: copy the code and modify there; |
|
327 |
leave the stuff below as it is." |
|
328 |
||
329 |
^ [:ex | |
|
330 |
|str printedException doMail emergencyMailReceiver pipe| |
|
331 |
||
332 |
ex signal == NoHandlerError ifTrue:[ |
|
333 |
printedException := ex unhandledException. |
|
334 |
] ifFalse:[ |
|
335 |
printedException := ex |
|
336 |
]. |
|
337 |
||
338 |
"/ user interruption is handled specially: |
|
339 |
"/ allow user to choose between proceeding or aborting |
|
340 |
"/ but never dump that information to the file. |
|
341 |
||
342 |
printedException signal == UserInterrupt ifTrue:[ |
|
343 |
(self confirm:'abort current action ?') ifTrue:[ |
|
344 |
AbortOperationRequest raise |
|
345 |
]. |
|
346 |
ex proceedWith:nil |
|
347 |
]. |
|
348 |
||
349 |
"/ somehow get the name of the guy to receive the mail |
|
350 |
"/ you have to implement that yourself. |
|
351 |
||
352 |
"/ emergencyMailReceiver := OneOfYourClass getEmergencyMailReceiver. |
|
353 |
emergencyMailReceiver := OperatingSystem getLoginName. |
|
354 |
||
355 |
emergencyMailReceiver isNil ifTrue:[ |
|
356 |
self warn:(printedException description |
|
357 |
, '\\No mailing to service people possible.') withCRs. |
|
358 |
doMail := false. |
|
359 |
] ifFalse:[ |
|
360 |
doMail := self confirm:(printedException description |
|
361 |
, '\\Mail error information to the service people (' |
|
362 |
, emergencyMailReceiver , ') ?') withCRs |
|
363 |
]. |
|
364 |
doMail ifTrue:[ |
|
365 |
str := '' writeStream. |
|
366 |
||
367 |
str nextPutLine:('Error notification from ' |
|
368 |
, OperatingSystem getLoginName |
|
369 |
, '@' |
|
370 |
, OperatingSystem getHostName). |
|
371 |
str cr. |
|
372 |
||
373 |
str nextPutLine:('Time: ' , Timestamp now printString). |
|
374 |
str nextPutLine:('Error: ', printedException description). |
|
375 |
str nextPutLine:('Signal: ', printedException signal printString). |
|
376 |
str nextPutLine:('Parameter: ', printedException parameter printString). |
|
377 |
str nextPutLine:('Process: ', Processor activeProcess printString). |
|
378 |
str nextPutLine:'Backtrace:'. |
|
379 |
str cr. |
|
380 |
||
381 |
printedException suspendedContext fullPrintAllOn:str. |
|
382 |
str cr;cr. |
|
383 |
||
384 |
str close. |
|
385 |
||
386 |
pipe := PipeStream |
|
387 |
writingTo:'mail ', emergencyMailReceiver. |
|
388 |
pipe notNil ifTrue:[ |
|
389 |
pipe nextPutLine:'Subject: automatic error report'. |
|
390 |
pipe nextPutAll:str contents. |
|
391 |
pipe cr. |
|
392 |
pipe close. |
|
393 |
] |
|
394 |
]. |
|
395 |
||
396 |
AbortOperationRequest raise. |
|
397 |
"not reached" |
|
398 |
] |
|
399 |
||
400 |
"test with (try a few halts or CTRL-C's): |
|
401 |
NoHandlerError emergencyHandler:(NoHandlerError mailingEmergencyHandler) |
|
402 |
" |
|
403 |
||
404 |
"back with: |
|
405 |
NoHandlerError emergencyHandler:(NoHandlerError notifyingEmergencyHandler) |
|
406 |
NoHandlerError emergencyHandler:nil |
|
407 |
" |
|
408 |
||
409 |
"Created: / 15.1.1997 / 20:14:52 / cg" |
|
410 |
"Modified: / 15.1.1997 / 21:10:28 / cg" |
|
411 |
"Modified: / 4.8.1999 / 08:11:26 / stefan" |
|
412 |
! |
|
413 |
||
414 |
notifyingEmergencyHandler |
|
415 |
"return a block (usable as an emergency handler for exceptions), |
|
416 |
which does errorNotification before going into the debugger. |
|
417 |
Halts and breakpoints go directly into the debugger (without asking)" |
|
418 |
||
419 |
^ [:ex | |
|
11233
4c35e5414ddf
got rid of the \"unhandled...(\" prefix in the debugger;
Claus Gittinger <cg@exept.de>
parents:
10731
diff
changeset
|
420 |
|message| |
4c35e5414ddf
got rid of the \"unhandled...(\" prefix in the debugger;
Claus Gittinger <cg@exept.de>
parents:
10731
diff
changeset
|
421 |
|
4c35e5414ddf
got rid of the \"unhandled...(\" prefix in the debugger;
Claus Gittinger <cg@exept.de>
parents:
10731
diff
changeset
|
422 |
message := ex descriptionForDebugger. |
4c35e5414ddf
got rid of the \"unhandled...(\" prefix in the debugger;
Claus Gittinger <cg@exept.de>
parents:
10731
diff
changeset
|
423 |
|
8678 | 424 |
(ex signal == NoHandlerError |
11303
48759a62953b
clean up #notifyingEmegencyHandler
Stefan Vogel <sv@exept.de>
parents:
11233
diff
changeset
|
425 |
and:[(ControlInterrupt handles:ex unhandledException) |
48759a62953b
clean up #notifyingEmegencyHandler
Stefan Vogel <sv@exept.de>
parents:
11233
diff
changeset
|
426 |
and:[(ControlInterrupt ~~ ex unhandledException signal) ]]) ifTrue:[ |
8678 | 427 |
"/ go directly into the debugger ... |
428 |
^ Debugger |
|
9994
2dcde06ef1fc
When opening a debugger, make sure that the topmost context is returnable
Stefan Vogel <sv@exept.de>
parents:
9273
diff
changeset
|
429 |
enter:ex returnableSuspendedContext |
11233
4c35e5414ddf
got rid of the \"unhandled...(\" prefix in the debugger;
Claus Gittinger <cg@exept.de>
parents:
10731
diff
changeset
|
430 |
withMessage:message |
8678 | 431 |
mayProceed:true |
9273
3ef50bca3bf4
inheritsFrom: should not be used/redefined in the exception
Claus Gittinger <cg@exept.de>
parents:
8955
diff
changeset
|
432 |
]. |
3ef50bca3bf4
inheritsFrom: should not be used/redefined in the exception
Claus Gittinger <cg@exept.de>
parents:
8955
diff
changeset
|
433 |
"/ 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
|
434 |
^ nil |
11233
4c35e5414ddf
got rid of the \"unhandled...(\" prefix in the debugger;
Claus Gittinger <cg@exept.de>
parents:
10731
diff
changeset
|
435 |
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
|
436 |
from:ex returnableSuspendedContext |
9273
3ef50bca3bf4
inheritsFrom: should not be used/redefined in the exception
Claus Gittinger <cg@exept.de>
parents:
8955
diff
changeset
|
437 |
allowDebug:true |
8678 | 438 |
] |
439 |
||
440 |
"test with (NOTE: halt, breakpoints or CTRL-C's still go straight into the debugger): |
|
441 |
NoHandlerError emergencyHandler:(NoHandlerError notifyingEmergencyHandler). |
|
442 |
Object bla. |
|
443 |
" |
|
444 |
||
445 |
"back with: |
|
446 |
NoHandlerError emergencyHandler:nil |
|
447 |
" |
|
448 |
||
449 |
"Modified: / 16.11.2001 / 16:07:05 / cg" |
|
450 |
! |
|
451 |
||
452 |
notifyingEmergencyHandlerForUserProcesses |
|
453 |
"return a block (usable as an emergency handler for exceptions), |
|
454 |
which does errorNotification before going into the debugger, |
|
455 |
but only for exceptions occurring in user processes; |
|
456 |
systemProcesses are not debugged. |
|
457 |
Halts and breakpoints go directly into the debugger (without asking)" |
|
458 |
||
459 |
^ [:ex | |
|
460 |
||
11233
4c35e5414ddf
got rid of the \"unhandled...(\" prefix in the debugger;
Claus Gittinger <cg@exept.de>
parents:
10731
diff
changeset
|
461 |
|theException message| |
8678 | 462 |
|
463 |
Processor activeProcessIsSystemProcess ifTrue:[ |
|
464 |
'EmergencyHandler [info]: exception cought: ' errorPrint. |
|
465 |
ex signal == NoHandlerError ifTrue:[ |
|
466 |
theException := ex unhandledException. |
|
467 |
] ifFalse:[ |
|
468 |
theException := ex |
|
469 |
]. |
|
470 |
theException description errorPrintCR. |
|
471 |
AbortOperationRequest raise. |
|
472 |
] ifFalse:[ |
|
11233
4c35e5414ddf
got rid of the \"unhandled...(\" prefix in the debugger;
Claus Gittinger <cg@exept.de>
parents:
10731
diff
changeset
|
473 |
message := ex descriptionForDebugger. |
4c35e5414ddf
got rid of the \"unhandled...(\" prefix in the debugger;
Claus Gittinger <cg@exept.de>
parents:
10731
diff
changeset
|
474 |
|
8678 | 475 |
(ex signal == NoHandlerError |
11303
48759a62953b
clean up #notifyingEmegencyHandler
Stefan Vogel <sv@exept.de>
parents:
11233
diff
changeset
|
476 |
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
|
477 |
and:[ (ControlInterrupt ~~ ex unhandledException signal) ]]) ifTrue:[ |
8678 | 478 |
"/ go directly into the debugger ... |
479 |
^ Debugger |
|
9994
2dcde06ef1fc
When opening a debugger, make sure that the topmost context is returnable
Stefan Vogel <sv@exept.de>
parents:
9273
diff
changeset
|
480 |
enter:ex returnableSuspendedContext |
11233
4c35e5414ddf
got rid of the \"unhandled...(\" prefix in the debugger;
Claus Gittinger <cg@exept.de>
parents:
10731
diff
changeset
|
481 |
withMessage:message |
8678 | 482 |
mayProceed:true |
9273
3ef50bca3bf4
inheritsFrom: should not be used/redefined in the exception
Claus Gittinger <cg@exept.de>
parents:
8955
diff
changeset
|
483 |
]. |
3ef50bca3bf4
inheritsFrom: should not be used/redefined in the exception
Claus Gittinger <cg@exept.de>
parents:
8955
diff
changeset
|
484 |
"/ 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
|
485 |
^ nil |
11233
4c35e5414ddf
got rid of the \"unhandled...(\" prefix in the debugger;
Claus Gittinger <cg@exept.de>
parents:
10731
diff
changeset
|
486 |
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
|
487 |
from:ex returnableSuspendedContext |
9273
3ef50bca3bf4
inheritsFrom: should not be used/redefined in the exception
Claus Gittinger <cg@exept.de>
parents:
8955
diff
changeset
|
488 |
allowDebug:true |
8678 | 489 |
] |
490 |
] |
|
491 |
||
492 |
"test with: |
|
493 |
NoHandlerError emergencyHandler:(NoHandlerError notifyingEmergencyHandlerForUserProcesses) |
|
494 |
Object bla. |
|
495 |
" |
|
496 |
||
497 |
"back with: |
|
498 |
NoHandlerError emergencyHandler:nil |
|
499 |
" |
|
500 |
||
501 |
"Modified: / 16.11.2001 / 16:06:54 / cg" |
|
502 |
! ! |
|
503 |
||
504 |
!NoHandlerError methodsFor:'accessing'! |
|
505 |
||
506 |
unhandledException |
|
507 |
^ parameter |
|
4528 | 508 |
! ! |
509 |
||
510 |
!NoHandlerError methodsFor:'default actions'! |
|
511 |
||
512 |
defaultAction |
|
513 |
"This action is performed, if nobody handles the NoHandlerError. |
|
514 |
Look for either a per-process emergencyHandlerBlock |
|
10731 | 515 |
or the global emergencyHandler ..." |
4528 | 516 |
|
517 |
|block| |
|
518 |
||
519 |
Processor notNil ifTrue:[ |
|
520 |
"care for signal during startup (Processor not yet created)" |
|
521 |
block := Processor activeProcess emergencySignalHandler. |
|
522 |
]. |
|
523 |
block isNil ifTrue:[ |
|
524 |
block := self class emergencyHandler. |
|
525 |
block isNil ifTrue:[ |
|
526 |
"care for error during startup (Exception not yet initialized)" |
|
4539
7064506e8285
debugger entry protocol changed;
Claus Gittinger <cg@exept.de>
parents:
4528
diff
changeset
|
527 |
^ MiniDebugger |
5295 | 528 |
enterWithMessage:self description |
4539
7064506e8285
debugger entry protocol changed;
Claus Gittinger <cg@exept.de>
parents:
4528
diff
changeset
|
529 |
mayProceed:self mayProceed |
4528 | 530 |
]. |
531 |
]. |
|
532 |
||
4586
22c84f7f9b85
return nil from raise if proceeded in the debugger
Claus Gittinger <cg@exept.de>
parents:
4561
diff
changeset
|
533 |
^ block value:self |
4561 | 534 |
! |
535 |
||
536 |
noHandler |
|
537 |
"redefined to avoid recursive invocations" |
|
538 |
||
539 |
^ self |
|
4528 | 540 |
! ! |
541 |
||
11233
4c35e5414ddf
got rid of the \"unhandled...(\" prefix in the debugger;
Claus Gittinger <cg@exept.de>
parents:
10731
diff
changeset
|
542 |
!NoHandlerError methodsFor:'printing & storing'! |
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 |
descriptionForDebugger |
4c35e5414ddf
got rid of the \"unhandled...(\" prefix in the debugger;
Claus Gittinger <cg@exept.de>
parents:
10731
diff
changeset
|
545 |
"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
|
546 |
debugger title area" |
4c35e5414ddf
got rid of the \"unhandled...(\" prefix in the debugger;
Claus Gittinger <cg@exept.de>
parents:
10731
diff
changeset
|
547 |
|
4c35e5414ddf
got rid of the \"unhandled...(\" prefix in the debugger;
Claus Gittinger <cg@exept.de>
parents:
10731
diff
changeset
|
548 |
^ parameter description. |
4c35e5414ddf
got rid of the \"unhandled...(\" prefix in the debugger;
Claus Gittinger <cg@exept.de>
parents:
10731
diff
changeset
|
549 |
! ! |
4c35e5414ddf
got rid of the \"unhandled...(\" prefix in the debugger;
Claus Gittinger <cg@exept.de>
parents:
10731
diff
changeset
|
550 |
|
4539
7064506e8285
debugger entry protocol changed;
Claus Gittinger <cg@exept.de>
parents:
4528
diff
changeset
|
551 |
!NoHandlerError methodsFor:'queries'! |
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 |
mayProceed |
7064506e8285
debugger entry protocol changed;
Claus Gittinger <cg@exept.de>
parents:
4528
diff
changeset
|
554 |
"return true, if the exception handler is allowed to proceed |
7064506e8285
debugger entry protocol changed;
Claus Gittinger <cg@exept.de>
parents:
4528
diff
changeset
|
555 |
the execution where the exception occured." |
7064506e8285
debugger entry protocol changed;
Claus Gittinger <cg@exept.de>
parents:
4528
diff
changeset
|
556 |
|
10731 | 557 |
^ parameter isNil or:[parameter mayProceed]. |
4539
7064506e8285
debugger entry protocol changed;
Claus Gittinger <cg@exept.de>
parents:
4528
diff
changeset
|
558 |
! ! |
7064506e8285
debugger entry protocol changed;
Claus Gittinger <cg@exept.de>
parents:
4528
diff
changeset
|
559 |
|
4528 | 560 |
!NoHandlerError class methodsFor:'documentation'! |
561 |
||
562 |
version |
|
17892 | 563 |
^ '$Header: /cvs/stx/stx/libbasic/NoHandlerError.st,v 1.19 2010/03/13 10:31:25 cg Exp $' |
17756 | 564 |
! |
565 |
||
566 |
version_CVS |
|
17845 | 567 |
^ '§Header: /cvs/stx/stx/libbasic/NoHandlerError.st,v 1.19 2010/03/13 10:31:25 cg Exp §' |
17865 | 568 |
! |
569 |
||
570 |
version_SVN |
|
17910 | 571 |
^ '$Id: NoHandlerError.st 10758 2012-01-19 10:06:02Z vranyj1 $' |
4528 | 572 |
! ! |
7586 | 573 |
|
17846 | 574 |
NoHandlerError initialize! |
17892 | 575 |
|
17910 | 576 |