diff --git a/core/metamodel.class.php b/core/metamodel.class.php index 61d626db3..1f5a76a50 100644 --- a/core/metamodel.class.php +++ b/core/metamodel.class.php @@ -495,8 +495,7 @@ abstract class MetaModel return $sModuleName; } } catch (\Exception $e) { - IssueLog::Error("Cannot compute class properly", null, [$e->getTraceAsString(), $e->getMessage()]); - return ""; + throw new CoreException("Cannot find class module", ['class' => $sClass], '', $e); } return 'core'; diff --git a/tests/php-unit-tests/unitary-tests/core/MetaModelTest.php b/tests/php-unit-tests/unitary-tests/core/MetaModelTest.php index 241ddff5e..ed14c9c2b 100644 --- a/tests/php-unit-tests/unitary-tests/core/MetaModelTest.php +++ b/tests/php-unit-tests/unitary-tests/core/MetaModelTest.php @@ -501,7 +501,10 @@ class MetaModelTest extends ItopDataTestCase public function testGetCreatedIn_UnknownClass() { - $this->assertEquals('', MetaModel::GetModuleName('GABUZOMEU')); + $this->expectExceptionMessage("Cannot find class module"); + $this->expectException(CoreException::class); + + MetaModel::GetModuleName('GABUZOMEU'); } public function testGetCreatedIn_ClassComingFromCorePhpFile()