Replacing a StandardToolSet

Igor Stasenko siguctua at gmail.com
Wed Feb 6 08:21:21 UTC 2008


Hello again,

i'm stuck with a code to handle errors in squeak image.
I want to replace the default behavior, when unhandled error occurs is
to same as user pressing 'Abort' button.

This is a code snippet, how i doing this:

----
HydraDebugToolSet>>debugError: anError
	recursed == true ifTrue: [ ^ Processor terminateActive ].
	recursed := true.

	Transcript show: 'Error in interpreter (', HydraVM
myInterpreterInstance asString , ')',
		String cr,
		anError description,
		String cr,
		anError signalerContext shortStack.

	Smalltalk
		logError: anError description
		inContext: anError signalerContext
		to: 'HydraDebug.log'.

	recursed := false.
	Processor terminateActive.
	^ nil

----------

The problem in doing Processor terminateActive - i'm not sure if this
works exactly as abandoning process.
And i'm stuck, because if i don't put Processor terminateActive, then
it starts an infinite loop barfing on sending unknown message to nil
(i suspect that it's because i returning nil at exit).
But if i leave process termination , then interpreter exits very early
blaming me, that there is no scheduled processes left.
Does it means, that all processes in image stepped on error and i
killed them, or it just means, that there is no processes which can be
scheduled at current point of time (some can wait on semaphore for
external event occur).

Can anyone, please, advice, how to make this stinky code to work
without causing troubles?

-- 
Best regards,
Igor Stasenko AKA sig.



More information about the Squeak-dev mailing list