Piotr Labudda 10 лет назад
Родитель
Сommit
9ef5a68910

+ 5 - 4
SE/schema/gui/Schema_TableFactory.php

@@ -1,5 +1,6 @@
 <?php
 
+Lib::loadClass('SchemaException');
 require_once APP_PATH_SCHEMA . '/gui/Schema_TableBase.php';
 
 /**
@@ -27,17 +28,17 @@ class Schema_TableFactory {
 		//         "schema/gui/{$cleanHostName}/{$cleanSourceName}.{$cleanTableName}.php";
 		//         class Schema_{$cleanHostName}_{$cleanSourceName}_{$cleanTableName};
 		$pathCoreClass = APP_PATH_SCHEMA . "/gui/core/{$cleanSourceName}.{$cleanTableName}.php";
-		if (!file_exists($pathCoreClass)) throw new Exception("Core Class file not found '{$cleanSourceName}.{$cleanTableName}'");
+		if (!file_exists($pathCoreClass)) throw new SchemaException("Core Class file not found '{$cleanSourceName}.{$cleanTableName}'");
 		require_once $pathCoreClass;
 		$coreClassName = "Schema__Core__{$cleanSourceName}__{$cleanTableName}";
-		if (!class_exists($coreClassName)) throw new Exception("Config error for schema core class {$cleanSourceName}:{$cleanTableName}");
+		if (!class_exists($coreClassName)) throw new SchemaException("Config error for schema core class {$cleanSourceName}:{$cleanTableName}");
 
 		if ($cleanHostName) {
 			$pathCompanyClass = APP_PATH_SCHEMA . "/gui/company/{$cleanHostName}/{$cleanSourceName}.{$cleanTableName}.php";
 			$companyClassName = "Schema__{$cleanHostName}__{$cleanSourceName}__{$cleanTableName}";
-			if (!file_exists($pathCompanyClass)) throw new Exception("Host Class file not found '{$cleanHostName}/{$cleanSourceName}.{$cleanTableName}'");
+			if (!file_exists($pathCompanyClass)) throw new SchemaException("Host Class file not found '{$cleanHostName}/{$cleanSourceName}.{$cleanTableName}'");
 			require_once $pathCompanyClass;
-			if (!class_exists($companyClassName)) throw new Exception("Config error for schema company class {$cleanSourceName}:{$cleanTableName}");
+			if (!class_exists($companyClassName)) throw new SchemaException("Config error for schema company class {$cleanSourceName}:{$cleanTableName}");
 			return new $companyClassName();
 		} else {
 			return new $coreClassName();

+ 5 - 0
SE/se-lib/SchemaException.php

@@ -0,0 +1,5 @@
+<?php
+
+class SchemaException extends Exception {
+
+}

+ 5 - 2
SE/se-lib/TableAcl.php

@@ -1,5 +1,7 @@
 <?php
 
+Lib::loadClass('SchemaException');
+
 /**
  * $_SESSION['TableAcl_cache'][$tableID] = array(
  *   [db] => DB zasob ID
@@ -931,9 +933,10 @@ class TableAcl {
 		$srvName = $_SERVER['SERVER_NAME'];
 		try {
 			$this->_schemaClass = Schema_TableFactory::build($this->_name, $this->_db, $srvName);
-		} catch (Exception $e) {
+		} catch (SchemaException $e) {// hide only schema not found, else re-throw
 			DBG::_('DBG_SCH', '>1', "Exception in Schema_TableFactory::build", $e->getMessage(), __CLASS__, __FUNCTION__, __LINE__);
-			// TODO: hide only not found, else re-throw
+		} catch (Exception $e) {
+			throw $e;
 		}
 		$this->_schemaLoaded = true;
 	}

+ 1 - 0
SE/se-lib/bootstrap.php

@@ -23,4 +23,5 @@ Lib::loadClass('StorageException');
 Lib::loadClass('Router');
 Lib::loadClass('Request');
 
+Lib::loadClass('SchemaException');
 require_once APP_PATH_SCHEMA . '/gui/Schema_TableFactory.php';