[Pharo-project] Refactoring>checkPreconditions behaves funny about the errorBlock

Niko Schwarz niko.schwarz at googlemail.com
Mon Oct 4 09:36:05 EDT 2010


The RB refactorings do some obscure dance around an errorBlock, which
is always nil, as far as I can see. As I was trying to supply a
non-nil error block, I was astonished to find out that even if it
isn't nil, it won't be executed. Here's the relevant snippets:

	| conditions block |
	conditions := self preconditions.
	conditions check
			[block := conditions errorBlock.
			block notNil
				ifTrue: [self refactoringError: conditions errorString with: block]
				ifFalse: [self refactoringError: conditions errorString]]

refactoringError: aString with: aBlock
	^ RefactoringError signal: aString with: aBlock

I can't imagine how that could help anyone. I suggest either removing
the errorBlock, or turning it into a good old instance variable, and
running it in case of an error.



Tel: +41 076 235 8683

More information about the Pharo-dev mailing list