[Cuis-dev] Context in Exception

Hilaire Fernandes hfern at free.fr
Thu Apr 25 11:01:28 PDT 2024


Hi,

I will need some help there because this is uncharted territory for me.

When the user executes a faulty Smalltalk sketch, I want to catch the 
exception and present the error in a simplified debugger. To not help, 
the Smalltalk sketch is evaluated in a low priority process, so the GUI 
remain interactive.

What I do is this:

	sketchProcess  :=  [
		(DrGeoSystem  preferences  at:  #advancedDebugger)
			ifTrue:  [Compiler  evaluate:  model]
			ifFalse:  [
				[Compiler  evaluate:  model]
					on:  Exception  
					do:  [:ex  |  |myContext |
						myContext  :=  ex  signalerContext  findContextSuchThat:  [:aContext  |  
							aContext  method  defaultSelector  ==  #DoIt].
					debugger  :=  Debugger  
							openMinimalDebuggingProcess:  sketchProcess  
							context:  myContext.
					self  plugDebugger  ]
			].
	sketchProcess  
		priority:  Processor  userSchedulingPriority  ;
		name:  '[DrGeo] Smalltalk Sketch execution';
		resume.


Sadly, when I present the error with my MinimalDebbugger all the 
variables within the script are nil (see screenshot below). When  
instead I use the standard Debugger with:

     Debugger openProcess: sketchProcess context: myContext label: 'Debug'

the variable values are ok. I tried to mimic the behavior of the regular 
debugger, but I likely miss something.

debug


Thanks

-- 
GNU Dr. Geo
http://gnu.org/s/dr-geo/
http://gnu-drgeo.blogspot.com/
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.cuis.st/mailman/archives/cuis-dev/attachments/20240425/af883ed4/attachment-0001.htm>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: Capture d??cran du 2024-04-25 19-31-19.png
Type: image/png
Size: 22325 bytes
Desc: not available
URL: <http://lists.cuis.st/mailman/archives/cuis-dev/attachments/20240425/af883ed4/attachment-0001.png>


More information about the Cuis-dev mailing list