diff --git a/code/ModelAdmin.php b/code/ModelAdmin.php index 5af2b9c1c..1ef00def9 100644 --- a/code/ModelAdmin.php +++ b/code/ModelAdmin.php @@ -3,6 +3,7 @@ namespace SilverStripe\Admin; use InvalidArgumentException; +use Psr\Log\LoggerInterface; use SilverStripe\Control\Controller; use SilverStripe\Control\HTTPRequest; use SilverStripe\Control\HTTPResponse; @@ -162,7 +163,8 @@ protected function init() $this->modelTab = $this->unsanitiseClassName($this->modelTab); if (!$this->isManagedModel($this->modelTab)) { - throw new \RuntimeException(sprintf('ModelAdmin::init(): Invalid Model class %s', $this->modelTab)); + Injector::inst()->get(LoggerInterface::class)->error(sprintf('ModelAdmin::init(): Invalid Model class %s', $this->modelTab)); + return $this->httpError(404, 'Page not found'); } }