[Cuis-dev] Context in Exception

Andres Valloud ten at smallinteger.com
Thu Apr 25 13:47:38 PDT 2024


FYI, this approach is handling every exception, including notifications 
whose default action is typically to do nothing.  It seems to me the 
code should only be handling UnhandledException (to give default 
handlers of any exceptions that do occur a chance to run).

On 4/25/24 11:01 AM, Hilaire Fernandes via Cuis-dev wrote:
> 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/
> 
> 


More information about the Cuis-dev mailing list