[squeak-dev] The Trunk: Tools-mt.1105.mcz

commits at source.squeak.org commits at source.squeak.org
Fri Jan 14 15:50:25 UTC 2022


Marcel Taeumel uploaded a new version of Tools to project The Trunk:
http://source.squeak.org/trunk/Tools-mt.1105.mcz

==================== Summary ====================

Name: Tools-mt.1105
Author: mt
Time: 14 January 2022, 4:50:22.513919 pm
UUID: d5036460-6e47-7642-a323-a0f40b3dd559
Ancestors: Tools-eem.1104

When a menu builder fails, show a warning that can be suppressed if too annoying. Proceed that warning to open a debugger for the exception that made the menu builder fail.

Note that this is the first time that we use a warning to maybe mask an exception via the "suppress warning" feature.

=============== Diff against Tools-eem.1104 ===============

Item was added:
+ Warning subclass: #MenuBuilderFailed
+ 	instanceVariableNames: 'builderError'
+ 	classVariableNames: ''
+ 	poolDictionaries: ''
+ 	category: 'Tools-Menus'!

Item was added:
+ ----- Method: MenuBuilderFailed class>>signal:for: (in category 'instance creation') -----
+ signal: signalerText for: builderError
+ 
+ 	^ self suppressed
+ 		ifTrue: [nil]
+ 		ifFalse: [self new
+ 			builderError: builderError;
+ 			signal: signalerText]!

Item was added:
+ ----- Method: MenuBuilderFailed>>builderError (in category 'accessing') -----
+ builderError
+ 
+ 	^ builderError!

Item was added:
+ ----- Method: MenuBuilderFailed>>builderError: (in category 'accessing') -----
+ builderError: anObject
+ 
+ 	builderError := anObject.!

Item was added:
+ ----- Method: MenuBuilderFailed>>defaultAction (in category 'priv handling') -----
+ defaultAction
+ 
+ 	super defaultAction.
+ 	self builderError pass.!

Item was changed:
  ----- Method: Model>>buildMenu:withBuilders:shifted: (in category '*Tools-pluggable menus') -----
  buildMenu: aMenu withBuilders: builders shifted: aBoolean
  	" We let every builder modify the menu. Skip erroneous builders silently.
  	The builder should indicate whether to abort by returning nil."
  	| menu |
  	menu := aMenu.
  	builders do: [:builder |
  		menu := [self perform: builder method selector withEnoughArguments: { menu . aBoolean }]
+ 			on: Error do: [:ex |
+ 				MenuBuilderFailed
+ 					signal: ('Menu builder failed.\\{1}\\Proceed to debug the error. Suppress and cancel this warning to not see it again. Read on.' withCRs translated format: {ex message})
+ 					for: ex.
+ 				menu].
- 			ifError: [:msg | Transcript showln: 'Menu builder failed: ', msg. menu].
  		menu ifNil: [^ aMenu]].
  	^ menu
  !



More information about the Squeak-dev mailing list