From ecaf4b1994cc0c3f1c025e9ded468470dd291afa Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20Blizni=C4=8Denko?= Date: Sat, 2 Nov 2024 21:13:05 +0100 Subject: [PATCH] improved error when controller was not found --- repository/OpenPonk-Core/OPController.class.st | 4 ++-- repository/OpenPonk-Core/OPControllerFactory.class.st | 9 +++++++-- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/repository/OpenPonk-Core/OPController.class.st b/repository/OpenPonk-Core/OPController.class.st index fa3b205d..848bf63c 100644 --- a/repository/OpenPonk-Core/OPController.class.st +++ b/repository/OpenPonk-Core/OPController.class.st @@ -274,14 +274,14 @@ OPController >> removeControllerAndDiagramElement [ { #category : 'destruction' } OPController >> removeControllerAndModel [ - self removeDependent. + self removeDependentConrollersAndModels. self removeControllerAndDiagramElement. self removeModel. self model: nil ] { #category : 'destruction' } -OPController >> removeDependent [ +OPController >> removeDependentConrollersAndModels [ self dependentControllers do: [ :each | self diagramController controllers diff --git a/repository/OpenPonk-Core/OPControllerFactory.class.st b/repository/OpenPonk-Core/OPControllerFactory.class.st index af128eea..4c6d8bb9 100644 --- a/repository/OpenPonk-Core/OPControllerFactory.class.st +++ b/repository/OpenPonk-Core/OPControllerFactory.class.st @@ -37,9 +37,14 @@ OPControllerFactory >> initialize [ { #category : 'api - accessing' } OPControllerFactory >> newControllerFor: aModel [ + | controller | - controller := (registrations detect: [ :each | each isForModel: aModel ]) controllerClass - new. + controller := (registrations + detect: [ :each | each isForModel: aModel ] + ifNone: [ + self error: + 'Unable to find controller class for model: ' + , aModel asString ]) controllerClass new. controller model: aModel. ^ controller ]