Commit 41f7579b authored by jaapjansma's avatar jaapjansma
Browse files

Added file not found exception and ignore the file when it is not found.

parent 8d31cd5c
......@@ -61,6 +61,8 @@ class CRM_Civiconfig_Loader {
} catch (\CRM_Civiconfig_EntityException $e) {
$ret[$entityType] = "{$entityType}: ERROR - " . $e->getMessage();
} catch (\CRM_Civiconfig_ResourceFileNotFoundException $e) {
// Skipp the file.
}
}
......@@ -68,4 +70,4 @@ class CRM_Civiconfig_Loader {
return $ret;
}
}
\ No newline at end of file
}
......@@ -13,7 +13,7 @@
class CRM_Civiconfig_ParamsProvider_ResourcesDir extends CRM_Civiconfig_ParamsProvider {
protected $_resourcesPath = NULL;
/**
* Constructor.
*
......@@ -37,7 +37,7 @@ class CRM_Civiconfig_ParamsProvider_ResourcesDir extends CRM_Civiconfig_ParamsPr
* @param string $entityType CiviCRM entity type to create params for
* @return array $params Parameters
* @throws \CRM_Civiconfig_EntityException Thrown if json_decode returns false
*/
*/
public function getParamsArray($entityType) {
// Get file name: convert camelcase to underscore separated, and add an 's'.
......@@ -47,7 +47,7 @@ class CRM_Civiconfig_ParamsProvider_ResourcesDir extends CRM_Civiconfig_ParamsPr
// Check if file exists
if (!is_readable($jsonFile)) {
throw new \CRM_Civiconfig_EntityException("No readable JSON file for entity type '$entityType'.");
throw new \CRM_Civiconfig_ResourceFileNotFoundException("No readable JSON file for entity type '$entityType'.");
}
// Read file and try to parse JSON
......
<?php
/**
* @author Jaap Jansma <jaap.jansma@civicoop.org>
* @license AGPL-3.0
*/
/**
* Excception class for when a resource file is not found.
*/
class CRM_Civiconfig_ResourceFileNotFoundException extends Exception {
}
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment